mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Remove count parameter from SetViewports. No use foreseen.
This commit is contained in:
parent
1b5148bb6c
commit
49e5460c9c
16 changed files with 53 additions and 57 deletions
|
@ -112,7 +112,7 @@ public:
|
|||
|
||||
// Raster state
|
||||
void SetScissorRect(int left, int top, int width, int height) override;
|
||||
void SetViewports(int count, Viewport *viewports) override;
|
||||
void SetViewport(const Viewport &viewport) override;
|
||||
void SetBlendFactor(float color[4]) override {
|
||||
if (memcmp(blendFactor_, color, sizeof(float) * 4)) {
|
||||
memcpy(blendFactor_, color, sizeof(float) * 4);
|
||||
|
@ -420,20 +420,18 @@ void D3D11DrawContext::EndFrame() {
|
|||
curPipeline_ = nullptr;
|
||||
}
|
||||
|
||||
void D3D11DrawContext::SetViewports(int count, Viewport *viewports) {
|
||||
D3D11_VIEWPORT vp[4];
|
||||
for (int i = 0; i < count; i++) {
|
||||
DisplayRect<float> rc{ viewports[i].TopLeftX , viewports[i].TopLeftY, viewports[i].Width, viewports[i].Height };
|
||||
if (curRenderTargetView_ == bbRenderTargetView_) // Only the backbuffer is actually rotated wrong!
|
||||
RotateRectToDisplay(rc, curRTWidth_, curRTHeight_);
|
||||
vp[i].TopLeftX = rc.x;
|
||||
vp[i].TopLeftY = rc.y;
|
||||
vp[i].Width = rc.w;
|
||||
vp[i].Height = rc.h;
|
||||
vp[i].MinDepth = viewports[i].MinDepth;
|
||||
vp[i].MaxDepth = viewports[i].MaxDepth;
|
||||
}
|
||||
context_->RSSetViewports(count, vp);
|
||||
void D3D11DrawContext::SetViewport(const Viewport &viewport) {
|
||||
DisplayRect<float> rc{ viewport.TopLeftX , viewport.TopLeftY, viewport.Width, viewport.Height };
|
||||
if (curRenderTargetView_ == bbRenderTargetView_) // Only the backbuffer is actually rotated wrong!
|
||||
RotateRectToDisplay(rc, curRTWidth_, curRTHeight_);
|
||||
D3D11_VIEWPORT vp;
|
||||
vp.TopLeftX = rc.x;
|
||||
vp.TopLeftY = rc.y;
|
||||
vp.Width = rc.w;
|
||||
vp.Height = rc.h;
|
||||
vp.MinDepth = viewport.MinDepth;
|
||||
vp.MaxDepth = viewport.MaxDepth;
|
||||
context_->RSSetViewports(1, &vp);
|
||||
}
|
||||
|
||||
void D3D11DrawContext::SetScissorRect(int left, int top, int width, int height) {
|
||||
|
|
|
@ -573,7 +573,7 @@ public:
|
|||
|
||||
// Raster state
|
||||
void SetScissorRect(int left, int top, int width, int height) override;
|
||||
void SetViewports(int count, Viewport *viewports) override;
|
||||
void SetViewport(const Viewport &viewport) override;
|
||||
void SetBlendFactor(float color[4]) override;
|
||||
void SetStencilParams(uint8_t refValue, uint8_t writeMask, uint8_t compareMask) override;
|
||||
|
||||
|
@ -1173,12 +1173,12 @@ void D3D9Context::SetScissorRect(int left, int top, int width, int height) {
|
|||
dxstate.scissorTest.set(true);
|
||||
}
|
||||
|
||||
void D3D9Context::SetViewports(int count, Viewport *viewports) {
|
||||
int x = (int)viewports[0].TopLeftX;
|
||||
int y = (int)viewports[0].TopLeftY;
|
||||
int w = (int)viewports[0].Width;
|
||||
int h = (int)viewports[0].Height;
|
||||
dxstate.viewport.set(x, y, w, h, viewports[0].MinDepth, viewports[0].MaxDepth);
|
||||
void D3D9Context::SetViewport(const Viewport &viewport) {
|
||||
int x = (int)viewport.TopLeftX;
|
||||
int y = (int)viewport.TopLeftY;
|
||||
int w = (int)viewport.Width;
|
||||
int h = (int)viewport.Height;
|
||||
dxstate.viewport.set(x, y, w, h, viewport.MinDepth, viewport.MaxDepth);
|
||||
}
|
||||
|
||||
void D3D9Context::SetBlendFactor(float color[4]) {
|
||||
|
|
|
@ -385,9 +385,9 @@ public:
|
|||
renderManager_.SetScissor({ left, top, width, height });
|
||||
}
|
||||
|
||||
void SetViewports(int count, Viewport *viewports) override {
|
||||
void SetViewport(const Viewport &viewport) override {
|
||||
// Same structure, different name.
|
||||
renderManager_.SetViewport((GLRViewport &)*viewports);
|
||||
renderManager_.SetViewport((GLRViewport &)viewport);
|
||||
}
|
||||
|
||||
void SetBlendFactor(float color[4]) override {
|
||||
|
|
|
@ -425,7 +425,7 @@ public:
|
|||
void GetFramebufferDimensions(Framebuffer *fbo, int *w, int *h) override;
|
||||
|
||||
void SetScissorRect(int left, int top, int width, int height) override;
|
||||
void SetViewports(int count, Viewport *viewports) override;
|
||||
void SetViewport(const Viewport &viewport) override;
|
||||
void SetBlendFactor(float color[4]) override;
|
||||
void SetStencilParams(uint8_t refValue, uint8_t writeMask, uint8_t compareMask) override;
|
||||
|
||||
|
@ -1237,18 +1237,16 @@ void VKContext::SetScissorRect(int left, int top, int width, int height) {
|
|||
renderManager_.SetScissor(left, top, width, height);
|
||||
}
|
||||
|
||||
void VKContext::SetViewports(int count, Viewport *viewports) {
|
||||
if (count > 0) {
|
||||
// Ignore viewports more than the first.
|
||||
VkViewport viewport;
|
||||
viewport.x = viewports[0].TopLeftX;
|
||||
viewport.y = viewports[0].TopLeftY;
|
||||
viewport.width = viewports[0].Width;
|
||||
viewport.height = viewports[0].Height;
|
||||
viewport.minDepth = viewports[0].MinDepth;
|
||||
viewport.maxDepth = viewports[0].MaxDepth;
|
||||
renderManager_.SetViewport(viewport);
|
||||
}
|
||||
void VKContext::SetViewport(const Viewport &viewport) {
|
||||
// Ignore viewports more than the first.
|
||||
VkViewport vkViewport;
|
||||
vkViewport.x = viewport.TopLeftX;
|
||||
vkViewport.y = viewport.TopLeftY;
|
||||
vkViewport.width = viewport.Width;
|
||||
vkViewport.height = viewport.Height;
|
||||
vkViewport.minDepth = viewport.MinDepth;
|
||||
vkViewport.maxDepth = viewport.MaxDepth;
|
||||
renderManager_.SetViewport(vkViewport);
|
||||
}
|
||||
|
||||
void VKContext::SetBlendFactor(float color[4]) {
|
||||
|
|
|
@ -733,7 +733,7 @@ public:
|
|||
|
||||
// Dynamic state
|
||||
virtual void SetScissorRect(int left, int top, int width, int height) = 0;
|
||||
virtual void SetViewports(int count, Viewport *viewports) = 0;
|
||||
virtual void SetViewport(const Viewport &viewport) = 0;
|
||||
virtual void SetBlendFactor(float color[4]) = 0;
|
||||
virtual void SetStencilParams(uint8_t refValue, uint8_t writeMask, uint8_t compareMask) = 0;
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ void UIScreen::preRender() {
|
|||
viewport.Height = pixel_yres;
|
||||
viewport.MaxDepth = 1.0;
|
||||
viewport.MinDepth = 0.0;
|
||||
draw->SetViewports(1, &viewport);
|
||||
draw->SetViewport(viewport);
|
||||
draw->SetTargetSize(pixel_xres, pixel_yres);
|
||||
}
|
||||
|
||||
|
|
|
@ -207,7 +207,7 @@ bool FramebufferManagerCommon::ReadbackDepthbuffer(Draw::Framebuffer *fbo, int x
|
|||
auto *blitFBO = GetTempFBO(TempFBO::COPY, fbo->Width() * scaleX, fbo->Height() * scaleY);
|
||||
draw_->BindFramebufferAsRenderTarget(blitFBO, { RPAction::DONT_CARE, RPAction::DONT_CARE, RPAction::DONT_CARE }, "ReadbackDepthbufferSync");
|
||||
Draw::Viewport viewport = { 0.0f, 0.0f, (float)destW, (float)destH, 0.0f, 1.0f };
|
||||
draw_->SetViewports(1, &viewport);
|
||||
draw_->SetViewport(viewport);
|
||||
draw_->SetScissorRect(0, 0, fbo->Width() * scaleX, fbo->Height() * scaleY);
|
||||
|
||||
draw_->BindFramebufferAsTexture(fbo, TEX_SLOT_PSP_TEXTURE, FB_DEPTH_BIT, 0);
|
||||
|
|
|
@ -1429,8 +1429,8 @@ void FramebufferManagerCommon::DrawFramebufferToOutput(const u8 *srcPixels, int
|
|||
}
|
||||
|
||||
void FramebufferManagerCommon::SetViewport2D(int x, int y, int w, int h) {
|
||||
Draw::Viewport vp{ (float)x, (float)y, (float)w, (float)h, 0.0f, 1.0f };
|
||||
draw_->SetViewports(1, &vp);
|
||||
Draw::Viewport viewport{ (float)x, (float)y, (float)w, (float)h, 0.0f, 1.0f };
|
||||
draw_->SetViewport(viewport);
|
||||
}
|
||||
|
||||
void FramebufferManagerCommon::CopyDisplayToOutput(bool reallyDirty) {
|
||||
|
@ -3235,8 +3235,8 @@ void FramebufferManagerCommon::BlitUsingRaster(
|
|||
draw_->InvalidateFramebuffer(Draw::FB_INVALIDATION_LOAD, pipeline->info.writeChannel == RASTER_COLOR ? Draw::FB_COLOR_BIT : Draw::FB_DEPTH_BIT);
|
||||
}
|
||||
|
||||
Draw::Viewport vp{ 0.0f, 0.0f, (float)dest->Width(), (float)dest->Height(), 0.0f, 1.0f };
|
||||
draw_->SetViewports(1, &vp);
|
||||
Draw::Viewport viewport{ 0.0f, 0.0f, (float)dest->Width(), (float)dest->Height(), 0.0f, 1.0f };
|
||||
draw_->SetViewport(viewport);
|
||||
draw_->SetScissorRect(0, 0, (int)dest->Width(), (int)dest->Height());
|
||||
|
||||
draw2D_.Blit(pipeline, srcX1, srcY1, srcX2, srcY2, destX1, destY1, destX2, destY2, (float)srcW, (float)srcH, (float)destW, (float)destH, linearFilter, scaleFactor);
|
||||
|
|
|
@ -734,7 +734,7 @@ void PresentationCommon::CopyToOutput(OutputFlags flags, int uvRotation, float u
|
|||
int nextWidth, nextHeight;
|
||||
draw_->GetFramebufferDimensions(postShaderFramebuffer, &nextWidth, &nextHeight);
|
||||
Draw::Viewport viewport{ 0, 0, (float)nextWidth, (float)nextHeight, 0.0f, 1.0f };
|
||||
draw_->SetViewports(1, &viewport);
|
||||
draw_->SetViewport(viewport);
|
||||
draw_->SetScissorRect(0, 0, nextWidth, nextHeight);
|
||||
|
||||
CalculatePostShaderUniforms(lastWidth, lastHeight, nextWidth, nextHeight, shaderInfo, &uniforms);
|
||||
|
@ -853,7 +853,7 @@ void PresentationCommon::CopyToOutput(OutputFlags flags, int uvRotation, float u
|
|||
|
||||
auto setViewport = [&](float x, float y, float w, float h) {
|
||||
Draw::Viewport viewport{ x, y, w, h, 0.0f, 1.0f };
|
||||
draw_->SetViewports(1, &viewport);
|
||||
draw_->SetViewport(viewport);
|
||||
};
|
||||
|
||||
CardboardSettings cardboardSettings;
|
||||
|
|
|
@ -304,7 +304,7 @@ bool FramebufferManagerCommon::PerformWriteStencilFromMemory(u32 addr, int size,
|
|||
}
|
||||
|
||||
Draw::Viewport viewport = { 0.0f, 0.0f, (float)w, (float)h, 0.0f, 1.0f };
|
||||
draw_->SetViewports(1, &viewport);
|
||||
draw_->SetViewport(viewport);
|
||||
|
||||
// TODO: Switch the format to a single channel format?
|
||||
Draw::Texture *tex = MakePixelTexture(src, dstBuffer->fb_format, dstBuffer->fb_stride, dstBuffer->width, dstBuffer->height);
|
||||
|
|
|
@ -2247,8 +2247,8 @@ void TextureCacheCommon::ApplyTextureFramebuffer(VirtualFramebuffer *framebuffer
|
|||
draw_->BindFramebufferAsRenderTarget(depalFBO, { Draw::RPAction::DONT_CARE, Draw::RPAction::DONT_CARE, Draw::RPAction::DONT_CARE }, "Depal");
|
||||
draw_->InvalidateFramebuffer(Draw::FB_INVALIDATION_STORE, Draw::FB_DEPTH_BIT | Draw::FB_STENCIL_BIT);
|
||||
draw_->SetScissorRect(u1, v1, u2 - u1, v2 - v1);
|
||||
Draw::Viewport vp{ 0.0f, 0.0f, (float)depalWidth, (float)framebuffer->renderHeight, 0.0f, 1.0f };
|
||||
draw_->SetViewports(1, &vp);
|
||||
Draw::Viewport viewport{ 0.0f, 0.0f, (float)depalWidth, (float)framebuffer->renderHeight, 0.0f, 1.0f };
|
||||
draw_->SetViewport(viewport);
|
||||
|
||||
draw_->BindFramebufferAsTexture(framebuffer->fbo, 0, depth ? Draw::FB_DEPTH_BIT : Draw::FB_COLOR_BIT, Draw::ALL_LAYERS);
|
||||
if (clutRenderAddress_ == 0xFFFFFFFF) {
|
||||
|
@ -2352,8 +2352,8 @@ void TextureCacheCommon::ApplyTextureDepal(TexCacheEntry *entry) {
|
|||
draw_->BindFramebufferAsRenderTarget(depalFBO, { Draw::RPAction::DONT_CARE, Draw::RPAction::DONT_CARE, Draw::RPAction::DONT_CARE }, "Depal");
|
||||
draw_->InvalidateFramebuffer(Draw::FB_INVALIDATION_STORE, Draw::FB_DEPTH_BIT | Draw::FB_STENCIL_BIT);
|
||||
draw_->SetScissorRect(u1, v1, u2 - u1, v2 - v1);
|
||||
Draw::Viewport vp{ 0.0f, 0.0f, (float)texWidth, (float)texHeight, 0.0f, 1.0f };
|
||||
draw_->SetViewports(1, &vp);
|
||||
Draw::Viewport viewport{ 0.0f, 0.0f, (float)texWidth, (float)texHeight, 0.0f, 1.0f };
|
||||
draw_->SetViewport(viewport);
|
||||
|
||||
draw_->BindNativeTexture(0, GetNativeTextureView(entry));
|
||||
draw_->BindFramebufferAsTexture(dynamicClutFbo_, 1, Draw::FB_COLOR_BIT, 0);
|
||||
|
|
|
@ -442,7 +442,7 @@ void DrawEngineD3D11::ApplyDrawState(int prim) {
|
|||
void DrawEngineD3D11::ApplyDrawStateLate(bool applyStencilRef, uint8_t stencilRef) {
|
||||
// we go through Draw here because it automatically handles screen rotation, as needed in UWP on mobiles.
|
||||
if (gstate_c.IsDirty(DIRTY_VIEWPORTSCISSOR_STATE)) {
|
||||
draw_->SetViewports(1, &dynState_.viewport);
|
||||
draw_->SetViewport(dynState_.viewport);
|
||||
draw_->SetScissorRect(dynState_.scissor.left, dynState_.scissor.top, dynState_.scissor.right - dynState_.scissor.left, dynState_.scissor.bottom - dynState_.scissor.top);
|
||||
}
|
||||
if (gstate_c.IsDirty(DIRTY_RASTER_STATE)) {
|
||||
|
|
|
@ -133,7 +133,7 @@ bool FramebufferManagerGLES::ReadbackStencilbuffer(Draw::Framebuffer *fbo, int x
|
|||
auto *blitFBO = GetTempFBO(TempFBO::COPY, fbo->Width(), fbo->Height());
|
||||
draw_->BindFramebufferAsRenderTarget(blitFBO, { RPAction::DONT_CARE, RPAction::DONT_CARE, RPAction::DONT_CARE }, "ReadbackStencilbufferSync");
|
||||
Draw::Viewport viewport = { 0.0f, 0.0f, (float)fbo->Width(), (float)fbo->Height(), 0.0f, 1.0f };
|
||||
draw_->SetViewports(1, &viewport);
|
||||
draw_->SetViewport(viewport);
|
||||
|
||||
draw_->BindFramebufferAsTexture(fbo, TEX_SLOT_PSP_TEXTURE, FB_STENCIL_BIT, 0);
|
||||
draw_->BindSamplerStates(TEX_SLOT_PSP_TEXTURE, 1, &stencilReadbackSampler_);
|
||||
|
|
|
@ -1375,7 +1375,7 @@ void EmuScreen::preRender() {
|
|||
viewport.Height = pixel_yres;
|
||||
viewport.MaxDepth = 1.0;
|
||||
viewport.MinDepth = 0.0;
|
||||
draw->SetViewports(1, &viewport);
|
||||
draw->SetViewport(viewport);
|
||||
}
|
||||
draw->SetTargetSize(pixel_xres, pixel_yres);
|
||||
}
|
||||
|
@ -1523,7 +1523,7 @@ void EmuScreen::renderUI() {
|
|||
viewport.Height = pixel_yres;
|
||||
viewport.MaxDepth = 1.0;
|
||||
viewport.MinDepth = 0.0;
|
||||
thin3d->SetViewports(1, &viewport);
|
||||
thin3d->SetViewport(viewport);
|
||||
|
||||
if (root_) {
|
||||
UI::LayoutViewHierarchy(*ctx, root_, false);
|
||||
|
|
|
@ -375,7 +375,7 @@ void DrawGameBackground(UIContext &dc, const Path &gamePath, float x, float y, f
|
|||
viewport.Height = pixel_yres;
|
||||
viewport.MaxDepth = 1.0;
|
||||
viewport.MinDepth = 0.0;
|
||||
draw->SetViewports(1, &viewport);
|
||||
draw->SetViewport(viewport);
|
||||
dc.BeginFrame();
|
||||
dc.RebindTexture();
|
||||
dc.Begin();
|
||||
|
|
|
@ -201,7 +201,7 @@ bool PPSSPP_UWPMain::Render() {
|
|||
dp_xres = pixel_xres * g_dpi_scale_x;
|
||||
dp_yres = pixel_yres * g_dpi_scale_y;
|
||||
|
||||
context->RSSetViewports(1, &viewport);
|
||||
context->RSSetViewport(viewport);
|
||||
|
||||
NativeRender(ctx_.get());
|
||||
return true;
|
||||
|
|
Loading…
Add table
Reference in a new issue