mirror of
https://github.com/Ryujinx/SDL.git
synced 2024-12-23 04:55:34 +00:00
Fixed building SDL applications with Visual Studio and the clang toolset
Also fixed building 64-bit SDL with clang. 32-bit doesn't build because of the inline assembly for C runtime support.
This commit is contained in:
parent
12d33b33ca
commit
30d554e3d6
|
@ -118,7 +118,7 @@ extern DECLSPEC void SDLCALL SDL_AtomicUnlock(SDL_SpinLock *lock);
|
||||||
* The compiler barrier prevents the compiler from reordering
|
* The compiler barrier prevents the compiler from reordering
|
||||||
* reads and writes to globally visible variables across the call.
|
* reads and writes to globally visible variables across the call.
|
||||||
*/
|
*/
|
||||||
#if defined(_MSC_VER) && (_MSC_VER > 1200)
|
#if defined(_MSC_VER) && (_MSC_VER > 1200) && !defined(__clang__)
|
||||||
void _ReadWriteBarrier(void);
|
void _ReadWriteBarrier(void);
|
||||||
#pragma intrinsic(_ReadWriteBarrier)
|
#pragma intrinsic(_ReadWriteBarrier)
|
||||||
#define SDL_CompilerBarrier() _ReadWriteBarrier()
|
#define SDL_CompilerBarrier() _ReadWriteBarrier()
|
||||||
|
|
|
@ -157,7 +157,7 @@ typedef unsigned int uintptr_t;
|
||||||
/* Enable various audio drivers */
|
/* Enable various audio drivers */
|
||||||
#define SDL_AUDIO_DRIVER_WASAPI 1
|
#define SDL_AUDIO_DRIVER_WASAPI 1
|
||||||
#define SDL_AUDIO_DRIVER_DSOUND 1
|
#define SDL_AUDIO_DRIVER_DSOUND 1
|
||||||
#define SDL_AUDIO_DRIVER_XAUDIO2 1
|
#define SDL_AUDIO_DRIVER_XAUDIO2 0
|
||||||
#define SDL_AUDIO_DRIVER_WINMM 1
|
#define SDL_AUDIO_DRIVER_WINMM 1
|
||||||
#define SDL_AUDIO_DRIVER_DISK 1
|
#define SDL_AUDIO_DRIVER_DISK 1
|
||||||
#define SDL_AUDIO_DRIVER_DUMMY 1
|
#define SDL_AUDIO_DRIVER_DUMMY 1
|
||||||
|
|
|
@ -33,6 +33,12 @@
|
||||||
/* Need to do this here because intrin.h has C++ code in it */
|
/* Need to do this here because intrin.h has C++ code in it */
|
||||||
/* Visual Studio 2005 has a bug where intrin.h conflicts with winnt.h */
|
/* Visual Studio 2005 has a bug where intrin.h conflicts with winnt.h */
|
||||||
#if defined(_MSC_VER) && (_MSC_VER >= 1500) && (defined(_M_IX86) || defined(_M_X64))
|
#if defined(_MSC_VER) && (_MSC_VER >= 1500) && (defined(_M_IX86) || defined(_M_X64))
|
||||||
|
#ifdef __clang__
|
||||||
|
/* Many of the intrinsics SDL uses are not implemented by clang with Visual Studio */
|
||||||
|
#undef __MMX__
|
||||||
|
#undef __SSE__
|
||||||
|
#undef __SSE2__
|
||||||
|
#else
|
||||||
#include <intrin.h>
|
#include <intrin.h>
|
||||||
#ifndef _WIN64
|
#ifndef _WIN64
|
||||||
#define __MMX__
|
#define __MMX__
|
||||||
|
@ -40,6 +46,7 @@
|
||||||
#endif
|
#endif
|
||||||
#define __SSE__
|
#define __SSE__
|
||||||
#define __SSE2__
|
#define __SSE2__
|
||||||
|
#endif /* __clang__ */
|
||||||
#elif defined(__MINGW64_VERSION_MAJOR)
|
#elif defined(__MINGW64_VERSION_MAJOR)
|
||||||
#include <intrin.h>
|
#include <intrin.h>
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -761,6 +761,7 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags)
|
||||||
const char *error = (const char *)pErrorMsgs->lpVtbl->GetBufferPointer(pErrorMsgs);
|
const char *error = (const char *)pErrorMsgs->lpVtbl->GetBufferPointer(pErrorMsgs);
|
||||||
SDL_SetError("Couldn't assemble shader: %s", error);
|
SDL_SetError("Couldn't assemble shader: %s", error);
|
||||||
}
|
}
|
||||||
|
if (shader_data != NULL)
|
||||||
#else
|
#else
|
||||||
const DWORD shader_data[] = {
|
const DWORD shader_data[] = {
|
||||||
0xffff0200, 0x05000051, 0xa00f0000, 0xbd808081, 0xbf008081, 0xbf008081,
|
0xffff0200, 0x05000051, 0xa00f0000, 0xbd808081, 0xbf008081, 0xbf008081,
|
||||||
|
@ -780,7 +781,7 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags)
|
||||||
0x80e40000, 0x0000ffff
|
0x80e40000, 0x0000ffff
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
if (shader_data != NULL) {
|
{
|
||||||
result = IDirect3DDevice9_CreatePixelShader(data->device, shader_data, &data->ps_yuv);
|
result = IDirect3DDevice9_CreatePixelShader(data->device, shader_data, &data->ps_yuv);
|
||||||
if (!FAILED(result)) {
|
if (!FAILED(result)) {
|
||||||
renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_YV12;
|
renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_YV12;
|
||||||
|
|
Loading…
Reference in a new issue