diff --git a/core/linux-dist/x11.cpp b/core/linux-dist/x11.cpp index 8981fea59..4a88ccff5 100644 --- a/core/linux-dist/x11.cpp +++ b/core/linux-dist/x11.cpp @@ -31,10 +31,15 @@ map x11_keymap; int x11_dc_buttons = 0xFFFF; int x11_keyboard_input = 0; +int x11_width; +int x11_height; + int ndcid = 0; void* x11_glc; bool x11_fullscreen = false; +void* x11_vis; + enum { _NET_WM_STATE_REMOVE =0, @@ -236,8 +241,8 @@ void x11_window_create() sWA.event_mask = StructureNotifyMask | ExposureMask | ButtonPressMask | ButtonReleaseMask | KeyPressMask | KeyReleaseMask; ui32Mask = CWBackPixel | CWBorderPixel | CWEventMask | CWColormap; - int x11_width = cfgLoadInt("x11", "width", DEFAULT_WINDOW_WIDTH); - int x11_height = cfgLoadInt("x11", "height", DEFAULT_WINDOW_HEIGHT); + x11_width = cfgLoadInt("x11", "width", DEFAULT_WINDOW_WIDTH); + x11_height = cfgLoadInt("x11", "height", DEFAULT_WINDOW_HEIGHT); x11_fullscreen = (cfgLoadInt("x11", "fullscreen", DEFAULT_FULLSCREEN) > 0); if (x11_width < 0 || x11_height < 0) @@ -296,6 +301,7 @@ void x11_window_create() //(EGLNativeDisplayType)x11Display; x11_disp = (void*)x11Display; x11_win = (void*)x11Window; + x11_vis = (void*)x11Visual->visual; } else { diff --git a/core/rend/soft/softrend.cpp b/core/rend/soft/softrend.cpp index 8e468056f..d3ff0475a 100644 --- a/core/rend/soft/softrend.cpp +++ b/core/rend/soft/softrend.cpp @@ -38,8 +38,10 @@ DECL_ALIGN(32) u32 pixels[MAX_RENDER_PIXELS]; #if HOST_OS != OS_WINDOWS struct RECT { - int top, left, bottom, right; + int left, top, right, bottom; }; + +#include #endif union m128i { @@ -253,14 +255,7 @@ RendtriangleFn RendtriangleFns[3][2][2][2][4][2]; __m128i const_setAlpha; -__m128i shuffle_alpha -#if HOST_OS == OS_WINDOWS - = { - 0x0E, 0x80, 0x0E, 0x80, 0x0E, 0x80, 0x0E, 0x80, - 0x06, 0x80, 0x06, 0x80, 0x06, 0x80, 0x06, 0x80 -} -#endif -; +__m128i shuffle_alpha; TPL_DECL_pixel @@ -910,7 +905,9 @@ struct softrend : Renderer virtual bool Init() { const_setAlpha = _mm_set1_epi32(0xFF000000); - + u8 ushuffle[] = { 0x0E, 0x80, 0x0E, 0x80, 0x0E, 0x80, 0x0E, 0x80, 0x06, 0x80, 0x06, 0x80, 0x06, 0x80, 0x06, 0x80}; + memcpy(&shuffle_alpha, ushuffle, sizeof(shuffle_alpha)); + #if HOST_OS == OS_WINDOWS hWnd = (HWND)libPvr_GetRenderTarget(); @@ -1159,20 +1156,37 @@ struct softrend : Renderer #endif } + #define RR(x, a, b, c, d) (x + a), (x + b), (x + c), (x + d) + #define R(a, b, c, d) RR(12, a, b, c, d), RR(8, a, b, c, d), RR(4, a, b, c, d), RR(0, a, b, c, d) + + //R coefs should be adjusted to match pixel format + INLINE __m128 shuffle_pixel(__m128 v) { + return (__m128)_mm_shuffle_epi8((__m128i)v, _mm_set_epi8(R(0x80,2,1, 0))); + } + virtual void Present() { __m128* psrc = (__m128*)render_buffer; __m128* pdst = (__m128*)pixels; + #define SHUFFL(v) v + // #define SHUFFL(v) shuffle_pixel(v) + + #if HOST_OS == OS_WINDOWS + #define FLIP_Y 479 - + #else + #define FLIP_Y + #endif + const int stride = STRIDE_PIXEL_OFFSET / 4; for (int y = 0; y