More buildfixes for Windows on ARM

This commit is contained in:
Henrik Rydgard 2017-03-03 22:48:05 +01:00
parent f2ccd1d648
commit 7b3f84aae8
13 changed files with 45 additions and 18 deletions

View File

@ -18,7 +18,7 @@
#pragma once #pragma once
#include <vector> #include <vector>
#include <stdint.h> #include <cstdint>
#include "Common.h" #include "Common.h"
#include "ArmCommon.h" #include "ArmCommon.h"

View File

@ -17,6 +17,7 @@
#pragma once #pragma once
#include "ppsspp_config.h"
#include "CommonTypes.h" #include "CommonTypes.h"
#include "ColorConvNEON.h" #include "ColorConvNEON.h"
@ -138,25 +139,25 @@ void ConvertRGBA4444ToABGR4444Basic(u16 *dst, const u16 *src, u32 numPixels);
void ConvertRGBA5551ToABGR1555Basic(u16 *dst, const u16 *src, u32 numPixels); void ConvertRGBA5551ToABGR1555Basic(u16 *dst, const u16 *src, u32 numPixels);
void ConvertRGB565ToBGR565Basic(u16 *dst, const u16 *src, u32 numPixels); void ConvertRGB565ToBGR565Basic(u16 *dst, const u16 *src, u32 numPixels);
#if defined(ARM64) #if PPSSPP_ARCH(ARM64)
#define ConvertRGBA4444ToABGR4444 ConvertRGBA4444ToABGR4444NEON #define ConvertRGBA4444ToABGR4444 ConvertRGBA4444ToABGR4444NEON
#elif !defined(ARM) #elif !PPSSPP_ARCH(ARM)
#define ConvertRGBA4444ToABGR4444 ConvertRGBA4444ToABGR4444Basic #define ConvertRGBA4444ToABGR4444 ConvertRGBA4444ToABGR4444Basic
#else #else
extern Convert16bppTo16bppFunc ConvertRGBA4444ToABGR4444; extern Convert16bppTo16bppFunc ConvertRGBA4444ToABGR4444;
#endif #endif
#if defined(ARM64) #if PPSSPP_ARCH(ARM64)
#define ConvertRGBA5551ToABGR1555 ConvertRGBA5551ToABGR1555NEON #define ConvertRGBA5551ToABGR1555 ConvertRGBA5551ToABGR1555NEON
#elif !defined(ARM) #elif !PPSSPP_ARCH(ARM)
#define ConvertRGBA5551ToABGR1555 ConvertRGBA5551ToABGR1555Basic #define ConvertRGBA5551ToABGR1555 ConvertRGBA5551ToABGR1555Basic
#else #else
extern Convert16bppTo16bppFunc ConvertRGBA5551ToABGR1555; extern Convert16bppTo16bppFunc ConvertRGBA5551ToABGR1555;
#endif #endif
#if defined(ARM64) #if PPSSPP_ARCH(ARM64)
#define ConvertRGB565ToBGR565 ConvertRGB565ToBGR565NEON #define ConvertRGB565ToBGR565 ConvertRGB565ToBGR565NEON
#elif !defined(ARM) #elif !PPSSPP_ARCH(ARM)
#define ConvertRGB565ToBGR565 ConvertRGB565ToBGR565Basic #define ConvertRGB565ToBGR565 ConvertRGB565ToBGR565Basic
#else #else
extern Convert16bppTo16bppFunc ConvertRGB565ToBGR565; extern Convert16bppTo16bppFunc ConvertRGB565ToBGR565;

View File

@ -15,6 +15,7 @@
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "ppsspp_config.h"
#include "Common.h" #include "Common.h"
#include "MemoryUtil.h" #include "MemoryUtil.h"
#include "StringUtils.h" #include "StringUtils.h"

View File

@ -22,7 +22,7 @@
#include "Globals.h" #include "Globals.h"
static inline s16 ApplySampleVolume(s16 sample, int vol) { static inline s16 ApplySampleVolume(s16 sample, int vol) {
#if PPSSPP_ARCH(ARM) #if PPSSPP_ARCH(ARM) && !defined(_MSC_VER)
register int r; register int r;
asm volatile("smulwb %0, %1, %2\n\t" \ asm volatile("smulwb %0, %1, %2\n\t" \
"ssat %0, #16, %0" \ "ssat %0, #16, %0" \

View File

@ -28,12 +28,16 @@
static const u16 MEMORY_ALIGNED16(QuickTexHashInitial[8]) = {0xc00bU, 0x9bd9U, 0x4b73U, 0xb651U, 0x4d9bU, 0x4309U, 0x0083U, 0x0001U}; static const u16 MEMORY_ALIGNED16(QuickTexHashInitial[8]) = {0xc00bU, 0x9bd9U, 0x4b73U, 0xb651U, 0x4d9bU, 0x4309U, 0x0083U, 0x0001U};
#ifdef _MSC_VER
#define __builtin_prefetch(a,b,c)
#endif
u32 QuickTexHashNEON(const void *checkp, u32 size) { u32 QuickTexHashNEON(const void *checkp, u32 size) {
u32 check = 0; u32 check = 0;
__builtin_prefetch(checkp, 0, 0); __builtin_prefetch(checkp, 0, 0);
if (((intptr_t)checkp & 0xf) == 0 && (size & 0x3f) == 0) { if (((intptr_t)checkp & 0xf) == 0 && (size & 0x3f) == 0) {
#if defined(IOS) || PPSSPP_ARCH(ARM64) #if defined(IOS) || PPSSPP_ARCH(ARM64) || defined(_MSC_VER)
uint32x4_t cursor = vdupq_n_u32(0); uint32x4_t cursor = vdupq_n_u32(0);
uint16x8_t cursor2 = vld1q_u16(QuickTexHashInitial); uint16x8_t cursor2 = vld1q_u16(QuickTexHashInitial);
uint16x8_t update = vdupq_n_u16(0x2455U); uint16x8_t update = vdupq_n_u16(0x2455U);
@ -210,8 +214,7 @@ u32 ReliableHash32NEON(const void *input, size_t len, u32 seed) {
uint32x4_t prime32_2q = vdupq_n_u32(PRIME32_2); uint32x4_t prime32_2q = vdupq_n_u32(PRIME32_2);
uint32x4_t vq = vcombine_u32(vcreate_u32(v1 | ((U64)v2 << 32)), vcreate_u32(v3 | ((U64)v4 << 32))); uint32x4_t vq = vcombine_u32(vcreate_u32(v1 | ((U64)v2 << 32)), vcreate_u32(v3 | ((U64)v4 << 32)));
do do {
{
__builtin_prefetch(p + 0xc0, 0, 0); __builtin_prefetch(p + 0xc0, 0, 0);
vq = vmlaq_u32(vq, vld1q_u32((const U32*)p), prime32_2q); vq = vmlaq_u32(vq, vld1q_u32((const U32*)p), prime32_2q);
vq = vorrq_u32(vshlq_n_u32(vq, 13), vshrq_n_u32(vq, 32 - 13)); vq = vorrq_u32(vshlq_n_u32(vq, 13), vshrq_n_u32(vq, 32 - 13));
@ -263,12 +266,15 @@ static inline bool VectorIsNonZeroNEON(const uint32x4_t &v) {
return (low | high) != 0; return (low | high) != 0;
} }
#ifndef _MSC_VER
// MSVC consider this function the same as the one above! uint16x8_t is typedef'd to the same type as uint32x4_t.
static inline bool VectorIsNonZeroNEON(const uint16x8_t &v) { static inline bool VectorIsNonZeroNEON(const uint16x8_t &v) {
u64 low = vgetq_lane_u64(vreinterpretq_u64_u16(v), 0); u64 low = vgetq_lane_u64(vreinterpretq_u64_u16(v), 0);
u64 high = vgetq_lane_u64(vreinterpretq_u64_u16(v), 1); u64 high = vgetq_lane_u64(vreinterpretq_u64_u16(v), 1);
return (low | high) != 0; return (low | high) != 0;
} }
#endif
CheckAlphaResult CheckAlphaRGBA8888NEON(const u32 *pixelData, int stride, int w, int h) { CheckAlphaResult CheckAlphaRGBA8888NEON(const u32 *pixelData, int stride, int w, int h) {
const uint32x4_t zero = vdupq_n_u32(0); const uint32x4_t zero = vdupq_n_u32(0);

View File

@ -15,6 +15,8 @@
// Official git repository and contact information can be found at // Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "ppsspp_config.h"
#include <d3d11.h> #include <d3d11.h>
#include <d3dcompiler.h> #include <d3dcompiler.h>
@ -25,7 +27,6 @@
#include "math/math_util.h" #include "math/math_util.h"
#include "math/dataconv.h" #include "math/dataconv.h"
#include "util/text/utf8.h" #include "util/text/utf8.h"
#include "thin3d/d3d11_loader.h"
#include "Common/Common.h" #include "Common/Common.h"
#include "Core/Config.h" #include "Core/Config.h"
#include "Core/Reporting.h" #include "Core/Reporting.h"

View File

@ -32,7 +32,7 @@
#define IS_BIG_ENDIAN (*(const u16 *)"\0\xff" < 0x100) #define IS_BIG_ENDIAN (*(const u16 *)"\0\xff" < 0x100)
static inline u8 clamp_u8(int i) { static inline u8 clamp_u8(int i) {
#if PPSSPP_ARCH(ARM) #if PPSSPP_ARCH(ARM) && !defined(_MSC_VER)
asm("usat %0, #8, %1" : "=r"(i) : "r"(i)); asm("usat %0, #8, %1" : "=r"(i) : "r"(i));
#else #else
if (i > 255) if (i > 255)
@ -44,7 +44,7 @@ static inline u8 clamp_u8(int i) {
} }
static inline s16 clamp_s16(int i) { static inline s16 clamp_s16(int i) {
#if PPSSPP_ARCH(ARM) #if PPSSPP_ARCH(ARM) && !defined(_MSC_VER)
asm("ssat %0, #16, %1" : "=r"(i) : "r"(i)); asm("ssat %0, #16, %1" : "=r"(i) : "r"(i));
#else #else
if (i > 32767) if (i > 32767)

View File

@ -14,6 +14,10 @@
#include "thin3d/thin3d.h" #include "thin3d/thin3d.h"
#include "thin3d/d3d11_loader.h" #include "thin3d/d3d11_loader.h"
#if PPSSPP_PLATFORM(UWP)
#error This file should not be compiled for UWP.
#endif
D3D11Context::D3D11Context() : draw_(nullptr), adapterId(-1), hDC(nullptr), hWnd_(nullptr), hD3D11(nullptr) { D3D11Context::D3D11Context() : draw_(nullptr), adapterId(-1), hDC(nullptr), hWnd_(nullptr), hD3D11(nullptr) {
} }

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
#include <string.h> #include <cstring>
#include "base/arch.h" #include "base/arch.h"
#include "base/backtrace.h" #include "base/backtrace.h"
@ -22,8 +22,10 @@
#ifdef _M_X64 #ifdef _M_X64
inline void Crash() { int *x = (int *)1337; *x = 1; } inline void Crash() { int *x = (int *)1337; *x = 1; }
#else #elif defined(_M_IX86)
inline void Crash() { __asm { int 3 }; } inline void Crash() { __asm { int 3 }; }
#elif defined(_M_ARM)
inline void Crash() { int *x = (int *)1337; *x = 1; }
#endif #endif
#else #else

View File

@ -3088,7 +3088,7 @@ unsigned char *decompress_jpeg_image_from_stream(jpeg_decoder_stream *pStream, i
for (int y = 0; y < image_height; y++) for (int y = 0; y < image_height; y++)
{ {
const uint8* pScan_line; const uint8* pScan_line = nullptr;
uint scan_line_len; uint scan_line_len;
if (decoder.decode((const void**)&pScan_line, &scan_line_len) != JPGD_SUCCESS) if (decoder.decode((const void**)&pScan_line, &scan_line_len) != JPGD_SUCCESS)
{ {

View File

@ -1,5 +1,9 @@
#include "thin3d/d3d11_loader.h" #include "thin3d/d3d11_loader.h"
#if PPSSPP_PLATFORM(UWP)
#error This file should not be compiled for UWP.
#endif
static HMODULE g_DXGIModule; static HMODULE g_DXGIModule;
static HMODULE g_D3D11Module; static HMODULE g_D3D11Module;
static HMODULE g_D3DCompileModule; static HMODULE g_D3DCompileModule;

View File

@ -9,6 +9,10 @@
#include <d3d11.h> #include <d3d11.h>
#include <D3Dcompiler.h> #include <D3Dcompiler.h>
#if PPSSPP_PLATFORM(UWP)
#error This file should not be compiled for UWP.
#endif
typedef HRESULT (WINAPI *LPCREATEDXGIFACTORY)(REFIID, void **); typedef HRESULT (WINAPI *LPCREATEDXGIFACTORY)(REFIID, void **);
typedef HRESULT (WINAPI *LPD3D11CREATEDEVICEANDSWAPCHAIN)(__in_opt IDXGIAdapter *pAdapter, D3D_DRIVER_TYPE DriverType, HMODULE Software, UINT Flags, __in_ecount_opt(FeatureLevels) CONST D3D_FEATURE_LEVEL *pFeatureLevels, UINT FeatureLevels, UINT SDKVersion, __in_opt CONST DXGI_SWAP_CHAIN_DESC *pSwapChainDesc, __out_opt IDXGISwapChain **ppSwapChain, __out_opt ID3D11Device **ppDevice, __out_opt D3D_FEATURE_LEVEL *pFeatureLevel, __out_opt ID3D11DeviceContext **ppImmediateContext); typedef HRESULT (WINAPI *LPD3D11CREATEDEVICEANDSWAPCHAIN)(__in_opt IDXGIAdapter *pAdapter, D3D_DRIVER_TYPE DriverType, HMODULE Software, UINT Flags, __in_ecount_opt(FeatureLevels) CONST D3D_FEATURE_LEVEL *pFeatureLevels, UINT FeatureLevels, UINT SDKVersion, __in_opt CONST DXGI_SWAP_CHAIN_DESC *pSwapChainDesc, __out_opt IDXGISwapChain **ppSwapChain, __out_opt ID3D11Device **ppDevice, __out_opt D3D_FEATURE_LEVEL *pFeatureLevel, __out_opt ID3D11DeviceContext **ppImmediateContext);
typedef HRESULT (WINAPI *LPD3D11CREATEDEVICE)(IDXGIAdapter *, D3D_DRIVER_TYPE, HMODULE, UINT32, D3D_FEATURE_LEVEL *, UINT, UINT32, ID3D11Device **, D3D_FEATURE_LEVEL *, ID3D11DeviceContext **); typedef HRESULT (WINAPI *LPD3D11CREATEDEVICE)(IDXGIAdapter *, D3D_DRIVER_TYPE, HMODULE, UINT32, D3D_FEATURE_LEVEL *, UINT, UINT32, ID3D11Device **, D3D_FEATURE_LEVEL *, ID3D11DeviceContext **);

View File

@ -25,7 +25,7 @@
#endif #endif
#endif #endif
#if defined(__arm__) #if defined(__arm__) || defined(_M_ARM)
#define PPSSPP_ARCH_ARM 1 #define PPSSPP_ARCH_ARM 1
#define PPSSPP_ARCH_32BIT 1 #define PPSSPP_ARCH_32BIT 1
@ -43,6 +43,10 @@
#define PPSSPP_ARCH_ARM_NEON 1 #define PPSSPP_ARCH_ARM_NEON 1
#endif #endif
#if defined(_M_ARM)
#define PPSSPP_ARCH_ARMV7 1
#define PPSSPP_ARCH_ARM_NEON 1
#endif
//TODO: Remove this compat define //TODO: Remove this compat define
#ifndef ARM #ifndef ARM
#define ARM 1 #define ARM 1