Assorted cleanups. Don't assert on no clear mask.

This commit is contained in:
Henrik Rydgård 2018-04-06 23:29:44 +02:00
parent 86966684d4
commit ca0fb77080
8 changed files with 17 additions and 19 deletions

1
.gitignore vendored
View file

@ -38,6 +38,7 @@ PPSSPPDebug.exe.manifest
assets/flash0
UWP/icph
UWP/.vs
.vs
# For Mac
.DS_Store

View file

@ -587,12 +587,6 @@ rotateVBO:
} else if (result.action == SW_CLEAR) {
u32 clearColor = result.color;
float clearDepth = result.depth;
const float col[4] = {
((clearColor & 0xFF)) / 255.0f,
((clearColor & 0xFF00) >> 8) / 255.0f,
((clearColor & 0xFF0000) >> 16) / 255.0f,
((clearColor & 0xFF000000) >> 24) / 255.0f,
};
bool colorMask = gstate.isClearModeColorMask();
bool alphaMask = gstate.isClearModeAlphaMask();

View file

@ -167,9 +167,6 @@ void FramebufferManagerVulkan::DestroyDeviceObjects() {
}
void FramebufferManagerVulkan::NotifyClear(bool clearColor, bool clearAlpha, bool clearDepth, uint32_t color, float depth) {
float x, y, w, h;
CenterDisplayOutputRect(&x, &y, &w, &h, 480.0f, 272.0f, (float)pixelWidth_, (float)pixelHeight_, ROTATION_LOCKED_HORIZONTAL);
int mask = 0;
// The Clear detection takes care of doing a regular draw instead if separate masking
// of color and alpha is needed, so we can just treat them as the same.

View file

@ -327,7 +327,7 @@ bool GLRenderManager::CopyFramebufferToMemorySync(GLRFramebuffer *src, int aspec
// TODO: Do this properly.
srcFormat = Draw::DataFormat::D24_S8;
} else {
_assert_(false);
return false;
}
queueRunner_.CopyReadbackBuffer(w, h, srcFormat, destFormat, pixelStride, pixels);
return true;
@ -638,6 +638,8 @@ void GLPushBuffer::Flush() {
bool GLPushBuffer::AddBuffer() {
BufInfo info;
info.localMemory = (uint8_t *)AllocateAlignedMemory(size_, 16);
if (!info.localMemory)
return false;
info.buffer = render_->CreateBuffer(target_, size_, GL_DYNAMIC_DRAW);
buf_ = buffers_.size();
buffers_.push_back(info);

View file

@ -164,7 +164,7 @@ public:
void *Map(GLBufferStrategy strategy);
bool Unmap();
bool Mapped() {
bool Mapped() const {
return mapped_;
}
@ -768,8 +768,9 @@ public:
// If scissorW == 0, no scissor is applied.
void Clear(uint32_t clearColor, float clearZ, int clearStencil, int clearMask, int colorMask, int scissorX, int scissorY, int scissorW, int scissorH) {
_dbg_assert_(G3D, curRenderStep_ && curRenderStep_->stepType == GLRStepType::RENDER);
if (!clearMask)
return;
GLRRenderData data{ GLRRenderCommand::CLEAR };
_assert_(clearMask != 0); // What would be the point?
data.clear.clearMask = clearMask;
data.clear.clearColor = clearColor;
data.clear.clearZ = clearZ;
@ -825,15 +826,15 @@ public:
}
void UnregisterPushBuffer(GLPushBuffer *buffer) {
bool found = false;
int foundCount = 0;
for (int i = 0; i < MAX_INFLIGHT_FRAMES; i++) {
auto iter = frameData_[i].activePushBuffers.find(buffer);
if (iter != frameData_[i].activePushBuffers.end()) {
frameData_[i].activePushBuffers.erase(iter);
found = true;
foundCount++;
}
}
assert(found);
assert(foundCount == 1);
}
void SetSwapFunction(std::function<void()> swapFunction) {
@ -920,7 +921,7 @@ private:
GLQueueRunner queueRunner_;
// Thread state
int threadFrame_;
int threadFrame_ = -1;
bool nextFrame = false;
bool firstFrame = true;

View file

@ -614,6 +614,8 @@ bool VulkanRenderManager::InitDepthStencilBuffer(VkCommandBuffer cmd) {
void VulkanRenderManager::Clear(uint32_t clearColor, float clearZ, int clearStencil, int clearMask) {
_dbg_assert_(G3D, curRenderStep_ && curRenderStep_->stepType == VKRStepType::RENDER);
if (!clearMask)
return;
// If this is the first drawing command, merge it into the pass.
if (curRenderStep_->render.numDraws == 0) {
curRenderStep_->render.clearColor = clearColor;

View file

@ -937,7 +937,9 @@ void D3D9Context::Clear(int mask, uint32_t colorval, float depthVal, int stencil
if (mask & FBChannel::FB_COLOR_BIT) d3dMask |= D3DCLEAR_TARGET;
if (mask & FBChannel::FB_DEPTH_BIT) d3dMask |= D3DCLEAR_ZBUFFER;
if (mask & FBChannel::FB_STENCIL_BIT) d3dMask |= D3DCLEAR_STENCIL;
device_->Clear(0, NULL, d3dMask, (D3DCOLOR)SwapRB(colorval), depthVal, stencilVal);
if (d3dMask) {
device_->Clear(0, NULL, d3dMask, (D3DCOLOR)SwapRB(colorval), depthVal, stencilVal);
}
}
void D3D9Context::SetScissorRect(int left, int top, int width, int height) {

View file

@ -19,7 +19,7 @@
#include <vector>
#include <string>
#include <map>
#include <assert.h>
#include <cassert>
#include "Common/Vulkan/SPIRVDisasm.h"
#include "Core/Config.h"
@ -1189,7 +1189,6 @@ void VKContext::Clear(int clearMask, uint32_t colorval, float depthVal, int sten
mask |= VK_IMAGE_ASPECT_DEPTH_BIT;
if (clearMask & FBChannel::FB_STENCIL_BIT)
mask |= VK_IMAGE_ASPECT_STENCIL_BIT;
renderManager_.Clear(colorval, depthVal, stencilVal, mask);
}