Minor cleanups (combined two identical enums, misc)

This commit is contained in:
Henrik Rydgard 2017-02-15 11:06:59 +01:00
parent 3cc344a1b7
commit 5c918da774
15 changed files with 36 additions and 50 deletions

View File

@ -242,8 +242,8 @@ static const DefMappingStruct defaultOuyaMap[] = {
{VIRTKEY_PAUSE , NKCODE_BUTTON_THUMBR},
{VIRTKEY_AXIS_X_MIN, JOYSTICK_AXIS_X, -1},
{VIRTKEY_AXIS_X_MAX, JOYSTICK_AXIS_X, +1},
{VIRTKEY_AXIS_Y_MAX, JOYSTICK_AXIS_Y, -1},
{VIRTKEY_AXIS_Y_MIN, JOYSTICK_AXIS_Y, +1},
{VIRTKEY_AXIS_Y_MAX, JOYSTICK_AXIS_Y, -1},
};
static const DefMappingStruct defaultXperiaPlay[] = {

View File

@ -894,14 +894,14 @@ rotateVBO:
uint32_t clearFlag = 0;
if (gstate.isClearModeColorMask()) clearFlag |= Draw::COLOR;
if (gstate.isClearModeAlphaMask()) clearFlag |= Draw::STENCIL;
if (gstate.isClearModeDepthMask()) clearFlag |= Draw::DEPTH;
if (gstate.isClearModeColorMask()) clearFlag |= Draw::FBChannel::FB_COLOR_BIT;
if (gstate.isClearModeAlphaMask()) clearFlag |= Draw::FBChannel::FB_STENCIL_BIT;
if (gstate.isClearModeDepthMask()) clearFlag |= Draw::FBChannel::FB_DEPTH_BIT;
if (clearFlag & Draw::DEPTH) {
if (clearFlag & Draw::FBChannel::FB_DEPTH_BIT) {
framebufferManager_->SetDepthUpdated();
}
if (clearFlag & Draw::COLOR) {
if (clearFlag & Draw::FBChannel::FB_COLOR_BIT) {
framebufferManager_->SetColorUpdated(gstate_c.skipDrawReason);
}

View File

@ -149,7 +149,7 @@ void FramebufferManagerD3D11::SetTextureCache(TextureCacheD3D11 *tc) {
}
void FramebufferManagerD3D11::ClearBuffer(bool keepState) {
draw_->Clear(Draw::ClearFlag::COLOR | Draw::ClearFlag::DEPTH | Draw::ClearFlag::STENCIL, 0, ToScaledDepth(0), 0);
draw_->Clear(Draw::FBChannel::FB_COLOR_BIT | Draw::FBChannel::FB_DEPTH_BIT | Draw::FBChannel::FB_STENCIL_BIT, 0, ToScaledDepth(0), 0);
}
void FramebufferManagerD3D11::DisableState() {

View File

@ -201,7 +201,7 @@ bool FramebufferManagerD3D11::NotifyStencilUpload(u32 addr, int size, bool skipZ
context_->RSSetViewports(1, &vp);
// Zero stencil
draw_->Clear(Draw::ClearFlag::STENCIL, 0, 0, 0);
draw_->Clear(Draw::FBChannel::FB_STENCIL_BIT, 0, 0, 0);
float fw = dstBuffer->width;
float fh = dstBuffer->height;

View File

@ -258,7 +258,7 @@ void SoftGPU::CopyToCurrentFboFromDisplayRam(int srcwidth, int srcheight) {
draw_->BindIndexBuffer(idata, 0);
draw_->DrawIndexed(6, 0);
} else {
draw_->Clear(Draw::COLOR, 0, 0, 0);
draw_->Clear(Draw::FB_COLOR_BIT, 0, 0, 0);
}
}

View File

@ -991,7 +991,7 @@ void EmuScreen::render() {
if (!useBufferedRendering) {
DrawContext *draw = screenManager()->getDrawContext();
draw->Clear(ClearFlag::COLOR | ClearFlag::DEPTH | ClearFlag::STENCIL, 0xFF000000, 0.0f, 0);
draw->Clear(FBChannel::FB_COLOR_BIT | FBChannel::FB_DEPTH_BIT | FBChannel::FB_STENCIL_BIT, 0xFF000000, 0.0f, 0);
Viewport viewport;
viewport.TopLeftX = 0;

View File

@ -15,9 +15,9 @@ typedef DWORD (WINAPI *XInputGetState_t) (DWORD dwUserIndex, XINPUT_STATE* pStat
typedef DWORD (WINAPI *XInputSetState_t) (DWORD dwUserIndex, XINPUT_VIBRATION* pVibration);
typedef DWORD (WINAPI *XInputGetCapabilities_t) (DWORD dwUserIndex, DWORD dwFlags, XINPUT_CAPABILITIES* pCapabilities);
XInputGetState_t PPSSPP_XInputGetState = NULL;
XInputSetState_t PPSSPP_XInputSetState = NULL;
XInputGetCapabilities_t PPSSPP_XInputGetCapabilities = NULL;
static XInputGetState_t PPSSPP_XInputGetState = NULL;
static XInputSetState_t PPSSPP_XInputSetState = NULL;
static XInputGetCapabilities_t PPSSPP_XInputGetCapabilities = NULL;
static DWORD PPSSPP_XInputVersion = 0;
static HMODULE s_pXInputDLL = 0;
static int s_XInputDLLRefCount = 0;
@ -97,10 +97,8 @@ static const unsigned int xinput_ctrl_map_size = sizeof(xinput_ctrl_map) / sizeo
XinputDevice::XinputDevice() {
if (LoadXInputDLL() != 0) {
ERROR_LOG(SCECTRL, "Failed to load XInput! DLL missing");
WARN_LOG(SCECTRL, "Failed to load XInput! DLL missing");
}
ZeroMemory( &this->prevState, sizeof(this->prevState) );
this->check_delay = 0;
this->gamepad_idx = -1;
}

View File

@ -13,7 +13,7 @@ public:
private:
void ApplyButtons(XINPUT_STATE &state, InputState &input_state);
int gamepad_idx;
int check_delay;
XINPUT_STATE prevState;
u32 prevButtons;
int check_delay = 0;
XINPUT_STATE prevState{};
u32 prevButtons = 0;
};

View File

@ -150,9 +150,6 @@
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<Text Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="SPIRV-Cross\spirv.hpp" />
<ClInclude Include="SPIRV-Cross\spirv_cfg.hpp" />

View File

@ -1,8 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Text Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="SPIRV-Cross\spirv.hpp" />
<ClInclude Include="SPIRV-Cross\spirv_cfg.hpp" />

View File

@ -163,12 +163,6 @@ enum FragmentShaderPreset : int {
FS_MAX_PRESET,
};
enum ClearFlag : int {
COLOR = 1,
DEPTH = 2,
STENCIL = 4,
};
enum class TextureType : uint8_t {
UNKNOWN,
LINEAR1D,
@ -331,6 +325,8 @@ enum FBChannel {
FB_COLOR_BIT = 1,
FB_DEPTH_BIT = 2,
FB_STENCIL_BIT = 4,
// Implementation specific
FB_SURFACE_BIT = 32, // Used in conjunction with the others in D3D9 to get surfaces through get_api_texture
};

View File

@ -1132,33 +1132,33 @@ void D3D11DrawContext::BindSamplerStates(int start, int count, SamplerState **st
}
void D3D11DrawContext::Clear(int mask, uint32_t colorval, float depthVal, int stencilVal) {
if ((mask & ClearFlag::COLOR) && curRenderTargetView_) {
if ((mask & FBChannel::FB_COLOR_BIT) && curRenderTargetView_) {
float colorRGBA[4];
Uint8x4ToFloat4(colorRGBA, colorval);
context_->ClearRenderTargetView(curRenderTargetView_, colorRGBA);
}
if ((mask & (ClearFlag::DEPTH | ClearFlag::STENCIL)) && curDepthStencilView_) {
if ((mask & (FBChannel::FB_DEPTH_BIT | FBChannel::FB_STENCIL_BIT)) && curDepthStencilView_) {
UINT clearFlag = 0;
if (mask & ClearFlag::DEPTH)
if (mask & FBChannel::FB_DEPTH_BIT)
clearFlag |= D3D11_CLEAR_DEPTH;
if (mask & ClearFlag::STENCIL)
if (mask & FBChannel::FB_STENCIL_BIT)
clearFlag |= D3D11_CLEAR_STENCIL;
context_->ClearDepthStencilView(curDepthStencilView_, clearFlag, depthVal, stencilVal);
}
}
void D3D11DrawContext::CopyFramebufferImage(Framebuffer *srcfb, int level, int x, int y, int z, Framebuffer *dstfb, int dstLevel, int dstX, int dstY, int dstZ, int width, int height, int depth, int channelBits) {
void D3D11DrawContext::CopyFramebufferImage(Framebuffer *srcfb, int level, int x, int y, int z, Framebuffer *dstfb, int dstLevel, int dstX, int dstY, int dstZ, int width, int height, int depth, int channelBit) {
D3D11Framebuffer *src = (D3D11Framebuffer *)srcfb;
D3D11Framebuffer *dst = (D3D11Framebuffer *)dstfb;
ID3D11Texture2D *srcTex = nullptr;
ID3D11Texture2D *dstTex = nullptr;
switch (channelBits) {
case FB_COLOR_BIT:
switch (channelBit) {
case FBChannel::FB_COLOR_BIT:
srcTex = src->colorTex;
dstTex = dst->colorTex;
break;
case FB_DEPTH_BIT:
case FBChannel::FB_DEPTH_BIT:
srcTex = src->depthStencilTex;
dstTex = dst->depthStencilTex;
break;
@ -1171,7 +1171,7 @@ void D3D11DrawContext::CopyFramebufferImage(Framebuffer *srcfb, int level, int x
return;
}
if (channelBits != FB_DEPTH_BIT) {
if (channelBit != FBChannel::FB_DEPTH_BIT) {
// Non-full copies are not supported for the depth channel.
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);

View File

@ -911,10 +911,9 @@ static uint32_t SwapRB(uint32_t c) {
void D3D9Context::Clear(int mask, uint32_t colorval, float depthVal, int stencilVal) {
UINT d3dMask = 0;
if (mask & ClearFlag::COLOR) d3dMask |= D3DCLEAR_TARGET;
if (mask & ClearFlag::DEPTH) d3dMask |= D3DCLEAR_ZBUFFER;
if (mask & ClearFlag::STENCIL) d3dMask |= D3DCLEAR_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);
}

View File

@ -1133,11 +1133,11 @@ void OpenGLContext::Clear(int mask, uint32_t colorval, float depthVal, int stenc
float col[4];
Uint8x4ToFloat4(col, colorval);
GLuint glMask = 0;
if (mask & ClearFlag::COLOR) {
if (mask & FBChannel::FB_COLOR_BIT) {
glClearColor(col[0], col[1], col[2], col[3]);
glMask |= GL_COLOR_BUFFER_BIT;
}
if (mask & ClearFlag::DEPTH) {
if (mask & FBChannel::FB_DEPTH_BIT) {
#if defined(USING_GLES2)
glClearDepthf(depthVal);
#else
@ -1145,7 +1145,7 @@ void OpenGLContext::Clear(int mask, uint32_t colorval, float depthVal, int stenc
#endif
glMask |= GL_DEPTH_BUFFER_BIT;
}
if (mask & ClearFlag::STENCIL) {
if (mask & FBChannel::FB_STENCIL_BIT) {
glClearStencil(stencilVal);
glMask |= GL_STENCIL_BUFFER_BIT;
}

View File

@ -1175,17 +1175,16 @@ void VKContext::DrawUP(const void *vdata, int vertexCount) {
}
void VKContext::Clear(int mask, uint32_t colorval, float depthVal, int stencilVal) {
if (mask & ClearFlag::COLOR) {
if (mask & FBChannel::FB_COLOR_BIT) {
VkClearColorValue col;
Uint8x4ToFloat4(colorval, col.float32);
/*
VkRect3D rect;
rect.extent.width =
vkCmdClearColorAttachment(cmdBuf_, 0, imageLayout_, &col, 1, nullptr);
*/
}
if (mask & (ClearFlag::DEPTH | ClearFlag::STENCIL)) {
if (mask & (FBChannel::FB_DEPTH_BIT | FBChannel::FB_STENCIL_BIT)) {
}
}