wiiu: update drivers for 2.0.22

This commit is contained in:
GaryOderNichts 2022-08-13 22:52:11 +02:00 committed by Dave Murphy
parent f36cf7c86f
commit 6cee733415
No known key found for this signature in database
GPG Key ID: F7FD5492264BB9D0
43 changed files with 1281 additions and 1595 deletions

View File

@ -238,7 +238,7 @@ if(USE_GCC OR USE_CLANG OR USE_INTELCC OR USE_QCC)
endif()
# Default option knobs
if(UNIX OR MINGW OR MSYS OR (USE_CLANG AND NOT WINDOWS) OR VITA OR PSP OR PS2 OR N3DS)
if(UNIX OR MINGW OR MSYS OR (USE_CLANG AND NOT WINDOWS) OR VITA OR PSP OR PS2 OR N3DS OR WIIU)
set(OPT_DEF_LIBC ON)
endif()
@ -350,7 +350,7 @@ if(EMSCRIPTEN)
set(SDL_CPUINFO_ENABLED_BY_DEFAULT OFF)
endif()
if(VITA OR PSP OR PS2 OR N3DS)
if(VITA OR PSP OR PS2 OR N3DS OR WIIU)
set(SDL_SHARED_ENABLED_BY_DEFAULT OFF)
set(SDL_LOADSO_ENABLED_BY_DEFAULT OFF)
endif()
@ -840,7 +840,7 @@ if(SDL_ASSEMBLY)
check_include_file("immintrin.h" HAVE_IMMINTRIN_H)
if(SDL_ALTIVEC)
if(SDL_ALTIVEC AND NOT WIIU)
set(CMAKE_REQUIRED_FLAGS "-maltivec")
check_c_source_compiles("
#include <altivec.h>
@ -2883,6 +2883,46 @@ elseif(N3DS)
endif()
list(APPEND EXTRA_LIBS ${lib})
endforeach()
elseif(WIIU)
if(SDL_AUDIO)
set(SDL_AUDIO_DRIVER_WIIU 1)
file(GLOB WIIU_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/wiiu/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${WIIU_AUDIO_SOURCES})
set(HAVE_SDL_AUDIO TRUE)
endif()
if(SDL_JOYSTICK)
set(SDL_JOYSTICK_WIIU 1)
file(GLOB WIIU_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/wiiu/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${WIIU_JOYSTICK_SOURCES})
set(HAVE_SDL_JOYSTICK TRUE)
endif()
if(SDL_THREADS)
set(SDL_THREAD_WIIU 1)
file(GLOB WIIU_THREAD_SOURCES ${SDL2_SOURCE_DIR}/src/thread/generic/SDL_systls.c ${SDL2_SOURCE_DIR}/src/thread/wiiu/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${WIIU_THREAD_SOURCES})
set(HAVE_SDL_THREADS TRUE)
endif()
if(SDL_TIMERS)
set(SDL_TIMER_WIIU 1)
file(GLOB WIIU_TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/wiiu/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${WIIU_TIMER_SOURCES})
set(HAVE_SDL_TIMERS TRUE)
endif()
if(SDL_VIDEO)
set(SDL_VIDEO_DRIVER_WIIU 1)
set(SDL_VIDEO_RENDER_WIIU 1)
file(GLOB WIIU_VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/wiiu/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${WIIU_VIDEO_SOURCES})
set(HAVE_SDL_VIDEO TRUE)
endif()
list(APPEND EXTRA_LIBS
wut
)
endif()
if(HAVE_VULKAN AND NOT SDL_LOADSO)

View File

@ -1,72 +0,0 @@
BASEDIR := $(dir $(firstword $(MAKEFILE_LIST)))
VPATH := $(BASEDIR)
#---------------------------------------------------------------------------------
# Build options
#---------------------------------------------------------------------------------
TARGET = libSDL2.a
SOURCES = \
src/*.c \
src/atomic/*.c \
src/audio/*.c \
src/audio/wiiu/*.c \
src/cpuinfo/*.c \
src/events/*.c \
src/file/*.c \
src/haptic/*.c \
src/haptic/dummy/*.c \
src/joystick/*.c \
src/joystick/wiiu/*.c \
src/joystick/dummy/*.c \
src/loadso/dummy/*.c \
src/power/*.c \
src/filesystem/dummy/*.c \
src/render/*.c \
src/render/wiiu/*.c \
src/render/software/*.c \
src/stdlib/*.c \
src/sensor/*.c \
src/thread/*.c \
src/thread/wiiu/*.c \
src/timer/*.c \
src/timer/wiiu/*.c \
src/timer/dummy/*.c \
src/video/*.c \
src/video/wiiu/*.c \
src/video/yuv2rgb/*.c \
src/video/dummy/*.c
OBJECTS = $(shell echo $(SOURCES) | sed -e 's,\.c,\.o,g')
INCLUDE = -I./include
#---------------------------------------------------------------------------------
# Compile flags
#---------------------------------------------------------------------------------
CFLAGS += -O2 $(INCLUDE)
CXXFLAGS += -O2 $(INCLUDE)
#---------------------------------------------------------------------------------
# Build rules
#---------------------------------------------------------------------------------
.PHONY: clean install
$(TARGET): $(OBJECTS)
install: $(TARGET)
@echo INSTALL $(TARGET)
@mkdir -p $(PORTLIBS)/lib
@mkdir -p $(PORTLIBS)/include/SDL2
@cp $(TARGET) $(PORTLIBS)/lib/
@cp -f ./include/*.h $(PORTLIBS)/include/SDL2/
clean:
@echo CLEAN ...
@rm -rf $(OBJECTS) $(OBJECTS:.o=.d) $(TARGET)
#---------------------------------------------------------------------------------
# Toolchain
#---------------------------------------------------------------------------------
include $(WUT_ROOT)/share/wut.mk
LDFLAGS += -L$(DEVKITPRO)/portlibs/ppc/lib
CFLAGS += -I$(DEVKITPRO)/portlibs/ppc/include
CXXFLAGS += -I$(DEVKITPRO)/portlibs/ppc/include

21
docs/README-wiiu.md Normal file
View File

@ -0,0 +1,21 @@
Wii U
=======
SDL port for the Nintendo Wii U
Credit to
* @rw-r-r-0644 and @QuarkTheAwesome for the initial Wii U port
* @GaryOderNichts
Building
--------
To build for the Wii U, make sure you have wut and wiiu-cmake installed and run:
```
/opt/devkitpro/portlibs/wiiu/bin/powerpc-eabi-cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$DEVKITPRO/portlibs/wiiu
cmake --build build
cmake --install build
```
Notes
-----
* TODO

View File

@ -49,6 +49,7 @@ More documentation and FAQs are available online at [the wiki](http://wiki.libsd
- [WinRT](README-winrt.md)
- [PSVita](README-vita.md)
- [Nokia N-Gage](README-ngage.md)
- [Wii U](README-wiiu.md)
If you need help with the library, or just want to discuss SDL related
issues, you can join the [SDL Discourse](https://discourse.libsdl.org/),

View File

@ -1,167 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef SDL_config_wiiu_h_
#define SDL_config_wiiu_h_
#define SDL_config_h_
#include "SDL_platform.h"
#ifdef __GNUC__
#define HAVE_GCC_SYNC_LOCK_TEST_AND_SET 1
#endif
#define HAVE_GCC_ATOMICS 1
#define STDC_HEADERS 1
#define HAVE_ALLOCA_H 1
#define HAVE_CTYPE_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_LIMITS_H 1
#define HAVE_MATH_H 1
#define HAVE_SIGNAL_H 1
#define HAVE_STDINT_H 1
#define HAVE_STDIO_H 1
#define HAVE_STRING_H 1
#define HAVE_SYS_TYPES_H 1
/* C library functions */
#define HAVE_MALLOC 1
#define HAVE_CALLOC 1
#define HAVE_REALLOC 1
#define HAVE_FREE 1
#define HAVE_ALLOCA 1
#define HAVE_GETENV 1
#define HAVE_SETENV 1
#define HAVE_PUTENV 1
#define HAVE_SETENV 1
#define HAVE_UNSETENV 1
#define HAVE_QSORT 1
#define HAVE_ABS 1
#define HAVE_BCOPY 1
#define HAVE_MEMSET 1
#define HAVE_MEMCPY 1
#define HAVE_MEMMOVE 1
#define HAVE_MEMCMP 1
#define HAVE_STRLEN 1
#define HAVE_STRLCPY 1
#define HAVE_STRLCAT 1
#define HAVE_STRCHR 1
#define HAVE_STRRCHR 1
#define HAVE_STRSTR 1
#define HAVE_STRTOL 1
#define HAVE_STRTOUL 1
#define HAVE_STRTOLL 1
#define HAVE_STRTOULL 1
#define HAVE_STRTOD 1
#define HAVE_ATOI 1
#define HAVE_ATOF 1
#define HAVE_STRCMP 1
#define HAVE_STRNCMP 1
#define HAVE_STRCASECMP 1
#define HAVE_STRNCASECMP 1
#define HAVE_VSSCANF 1
#define HAVE_VSNPRINTF 1
#define HAVE_M_PI 1
#define HAVE_ACOS 1
#define HAVE_ACOSF 1
#define HAVE_ASIN 1
#define HAVE_ASINF 1
#define HAVE_ATAN 1
#define HAVE_ATANF 1
#define HAVE_ATAN2 1
#define HAVE_ATAN2F 1
#define HAVE_CEIL 1
#define HAVE_CEILF 1
#define HAVE_COPYSIGN 1
#define HAVE_COPYSIGNF 1
#define HAVE_COS 1
#define HAVE_COSF 1
#define HAVE_EXP 1
#define HAVE_FABS 1
#define HAVE_FABSF 1
#define HAVE_FLOOR 1
#define HAVE_FLOORF 1
#define HAVE_FMOD 1
#define HAVE_FMODF 1
#define HAVE_LOG 1
#define HAVE_LOGF 1
#define HAVE_LOG10 1
#define HAVE_LOG10F 1
#define HAVE_POW 1
#define HAVE_POWF 1
#define HAVE_SCALBN 1
#define HAVE_SCALBNF 1
#define HAVE_SIN 1
#define HAVE_SINF 1
#define HAVE_SQRT 1
#define HAVE_SQRTF 1
#define HAVE_TAN 1
#define HAVE_TANF 1
#define HAVE_SETJMP 1
#define HAVE_NANOSLEEP 1
/* #define HAVE_SYSCONF 1 */
/* #define HAVE_SIGACTION 1 */
/* Wii U isn't that sophisticated */
#define LACKS_SYS_MMAN_H 1
/* Wii U thread support (src/thread/wiiu/\*.c) */
#define SDL_THREAD_WIIU 1
#define SDL_THREADS_DISABLED 0
/* Wii U timer support (src/timer/wiiu/\*.c) */
#define SDL_TIMER_WIIU 1
/* Wii U joystick driver (src/joystick/wiiu/\*.c) */
#define SDL_JOYSTICK_WIIU 1
/* Enable the wiiu audio driver (src/audio/wiiu/\*.c) */
#define SDL_AUDIO_DRIVER_WIIU 1
/* Wii U video dirver */
#define SDL_VIDEO_DRIVER_WIIU 1
/* Wii U render driver (src/render/wiiu/\*.c) */
#define SDL_VIDEO_RENDER_WIIU 1
/* There's no battery for the console unit */
#define SDL_POWER_DISABLED 1
/* !!! FIXME: what does Wii U do for filesystem stuff? */
#define SDL_FILESYSTEM_DUMMY 1
/* Wii U does have an haptic device, but it's not ported to sdl yet (src/haptic/dummy/\*.c) */
#define SDL_HAPTIC_DISABLED 1
/* Wii U can't load shared object (src/loadso/dummy/\*.c) */
#define SDL_LOADSO_DISABLED 1
/* Hack: for some reason some arch defines are missing in the
toolchain, so SDL_endian.h will think we're little endian
without that */
#define SDL_BYTEORDER SDL_BIG_ENDIAN
#endif /* SDL_config_wiiu_h_ */

View File

@ -124,6 +124,8 @@ typedef enum
SDL_WINDOW_TOOLTIP = 0x00040000, /**< window should be treated as a tooltip */
SDL_WINDOW_POPUP_MENU = 0x00080000, /**< window should be treated as a popup menu */
SDL_WINDOW_KEYBOARD_GRABBED = 0x00100000, /**< window has grabbed keyboard input */
SDL_WINDOW_WIIU_GAMEPAD_ONLY = 0x01000000, /**< Wii U: window must be drawn only on the Gamepad */
SDL_WINDOW_WIIU_TV_ONLY = 0x02000000, /**< Wii U: window must be drawn only on the TV */
SDL_WINDOW_VULKAN = 0x10000000, /**< window usable for Vulkan surface */
SDL_WINDOW_METAL = 0x20000000, /**< window usable for Metal view */

View File

@ -59,7 +59,7 @@ static SDL_AudioDevice* cb_this;
/* +1, but never goes above NUM_BUFFERS */
#define next_id(id) (id + 1) % NUM_BUFFERS
static int WIIUAUDIO_OpenDevice(_THIS, void* handle, const char* devname, int iscapture) {
static int WIIUAUDIO_OpenDevice(_THIS, const char* devname) {
AXVoiceOffsets offs;
AXVoiceVeData vol = {
.volume = 0x8000,
@ -370,7 +370,7 @@ static void WIIUAUDIO_ThreadInit(_THIS) {
OSSetThreadPriority(currentThread, priority);
}
static int WIIUAUDIO_Init(SDL_AudioDriverImpl* impl) {
static SDL_bool WIIUAUDIO_Init(SDL_AudioDriverImpl* impl) {
impl->OpenDevice = WIIUAUDIO_OpenDevice;
impl->PlayDevice = WIIUAUDIO_PlayDevice;
impl->WaitDevice = WIIUAUDIO_WaitDevice;
@ -378,9 +378,9 @@ static int WIIUAUDIO_Init(SDL_AudioDriverImpl* impl) {
impl->CloseDevice = WIIUAUDIO_CloseDevice;
impl->ThreadInit = WIIUAUDIO_ThreadInit;
impl->OnlyHasDefaultOutputDevice = 1;
impl->OnlyHasDefaultOutputDevice = SDL_TRUE;
return 1;
return SDL_TRUE;
}
AudioBootStrap WIIUAUDIO_bootstrap = {

View File

@ -46,6 +46,26 @@ static int deviceMap[MAX_CONTROLLERS];
static SDL_JoystickID instanceMap[MAX_CONTROLLERS];
static WPADExtensionType lastKnownExts[WIIU_NUM_WPADS];
static int WIIU_JoystickInit(void);
static int WIIU_JoystickGetCount(void);
static void WIIU_JoystickDetect(void);
static const char *WIIU_JoystickGetDeviceName(int device_index);
static int WIIU_JoystickGetDevicePlayerIndex(int device_index);
static void WIIU_JoystickSetDevicePlayerIndex(int device_index, int player_index);
static SDL_JoystickGUID WIIU_JoystickGetDeviceGUID(int device_index);
static SDL_JoystickID WIIU_JoystickGetDeviceInstanceID(int device_index);
static int WIIU_JoystickOpen(SDL_Joystick *joystick, int device_index);
static int WIIU_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble);
static int WIIU_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble);
static Uint32 WIIU_JoystickGetCapabilities(SDL_Joystick *joystick);
static int WIIU_JoystickSetLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue);
static int WIIU_JoystickSendEffect(SDL_Joystick *joystick, const void *data, int size);
static int WIIU_JoystickSetSensorsEnabled(SDL_Joystick *joystick, SDL_bool enabled);
static void WIIU_JoystickUpdate(SDL_Joystick *joystick);
static void WIIU_JoystickClose(SDL_Joystick *joystick);
static void WIIU_JoystickQuit(void);
static SDL_bool WIIU_JoystickGetGamepadMapping(int device_index, SDL_GamepadMapping * out);
static int WIIU_GetDeviceForIndex(int device_index) {
return deviceMap[device_index];
}
@ -237,6 +257,10 @@ static int WIIU_JoystickGetDevicePlayerIndex(int device_index)
}
static void WIIU_JoystickSetDevicePlayerIndex(int device_index, int player_index)
{
}
/* Function to return the stable GUID for a plugged in device */
static SDL_JoystickGUID WIIU_JoystickGetDeviceGUID(int device_index)
{
@ -264,7 +288,7 @@ static int WIIU_JoystickOpen(SDL_Joystick *joystick, int device_index)
int wiiu_device = WIIU_GetDeviceForIndex(device_index);
switch (wiiu_device) {
case WIIU_DEVICE_GAMEPAD: {
SDL_AddTouch(0, "WiiU Gamepad Touchscreen");
SDL_AddTouch(0, SDL_TOUCH_DEVICE_DIRECT, "WiiU Gamepad Touchscreen");
joystick->nbuttons = SIZEOF_ARR(vpad_button_map);
joystick->naxes = 4;
joystick->nhats = 0;
@ -323,12 +347,43 @@ static int WIIU_JoystickOpen(SDL_Joystick *joystick, int device_index)
}
/* Rumble functionality */
static int WIIU_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms)
static int WIIU_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble)
{
/* TODO */
return SDL_Unsupported();
}
static int WIIU_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble)
{
return SDL_Unsupported();
}
/* Capability detection */
static Uint32 WIIU_JoystickGetCapabilities(SDL_Joystick *joystick)
{
/* TODO implement supported capabilities */
return 0;
}
/* LED functionality */
static int WIIU_JoystickSetLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue)
{
return SDL_Unsupported();
}
/* General effects */
static int WIIU_JoystickSendEffect(SDL_Joystick *joystick, const void *data, int size)
{
return SDL_Unsupported();
}
/* Sensor functionality */
static int WIIU_JoystickSetSensorsEnabled(SDL_Joystick *joystick, SDL_bool enabled)
{
return SDL_Unsupported();
}
/* Function to update the state of a joystick - called as a device poll.
* This function shouldn't update the joystick structure directly,
* but instead should call SDL_PrivateJoystick*() to deliver events
@ -365,12 +420,12 @@ static void WIIU_JoystickUpdate(SDL_Joystick *joystick)
VPADGetTPCalibratedPoint(VPAD_CHAN_0, &tpdata, &vpad.tpNormal);
if (tpdata.touched) {
/* Send an initial touch */
SDL_SendTouch(0, 0, SDL_TRUE,
SDL_SendTouch(0, 0, NULL, SDL_TRUE,
(float) tpdata.x / 1280.0f,
(float) tpdata.y / 720.0f, 1);
/* Always send the motion */
SDL_SendTouchMotion(0, 0,
SDL_SendTouchMotion(0, 0, NULL,
(float) tpdata.x / 1280.0f,
(float) tpdata.y / 720.0f, 1);
@ -380,7 +435,7 @@ static void WIIU_JoystickUpdate(SDL_Joystick *joystick)
last_touched = 1;
} else if (last_touched) {
/* Finger released from screen */
SDL_SendTouch(0, 0, SDL_FALSE,
SDL_SendTouch(0, 0, NULL, SDL_FALSE,
(float) last_touch_x / 1280.0f,
(float) last_touch_y / 720.0f, 1);
last_touched = 0;
@ -512,6 +567,12 @@ static void WIIU_JoystickQuit(void)
{
}
/* Function to get the autodetected controller mapping; returns false if there isn't any. */
static SDL_bool WIIU_JoystickGetGamepadMapping(int device_index, SDL_GamepadMapping * out)
{
return SDL_FALSE;
}
SDL_JoystickDriver SDL_WIIU_JoystickDriver =
{
WIIU_JoystickInit,
@ -519,13 +580,20 @@ SDL_JoystickDriver SDL_WIIU_JoystickDriver =
WIIU_JoystickDetect,
WIIU_JoystickGetDeviceName,
WIIU_JoystickGetDevicePlayerIndex,
WIIU_JoystickSetDevicePlayerIndex,
WIIU_JoystickGetDeviceGUID,
WIIU_JoystickGetDeviceInstanceID,
WIIU_JoystickOpen,
WIIU_JoystickRumble,
WIIU_JoystickRumbleTriggers,
WIIU_JoystickGetCapabilities,
WIIU_JoystickSetLED,
WIIU_JoystickSendEffect,
WIIU_JoystickSetSensorsEnabled,
WIIU_JoystickUpdate,
WIIU_JoystickClose,
WIIU_JoystickQuit,
WIIU_JoystickGetGamepadMapping,
};
#endif

View File

@ -77,19 +77,6 @@ static WPADProButton pro_button_map[] = {
WPAD_PRO_STICK_R_EMULATION_RIGHT, WPAD_PRO_STICK_R_EMULATION_DOWN
};
static int WIIU_JoystickInit(void);
static int WIIU_JoystickGetCount(void);
static void WIIU_JoystickDetect(void);
static const char *WIIU_JoystickGetDeviceName(int device_index);
static int WIIU_JoystickGetDevicePlayerIndex(int device_index);
static SDL_JoystickGUID WIIU_JoystickGetDeviceGUID(int device_index);
static SDL_JoystickID WIIU_JoystickGetDeviceInstanceID(int device_index);
static int WIIU_JoystickOpen(SDL_Joystick *joystick, int device_index);
static int WIIU_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms);
static void WIIU_JoystickUpdate(SDL_Joystick *joystick);
static void WIIU_JoystickClose(SDL_Joystick *joystick);
static void WIIU_JoystickQuit(void);
#define RETURN_WPAD_NAME(chan, ext) { \
switch (ext) { \
case WPAD_EXT_CORE: \

View File

@ -1,444 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 2018-2019 Ash Logan <ash@heyquark.com>
Copyright (C) 2018-2019 Roberto Van Eeden <r.r.qwertyuiop.r.r@gmail.com>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "../../SDL_internal.h"
#if SDL_VIDEO_RENDER_WIIU
#include "../../video/wiiu/SDL_wiiuvideo.h"
#include "../../video/wiiu/wiiu_shaders.h"
#include "../SDL_sysrender.h"
#include "SDL_hints.h"
#include "SDL_render_wiiu.h"
#include <gx2/texture.h>
#include <gx2/draw.h>
#include <gx2/registers.h>
#include <gx2/sampler.h>
#include <gx2/state.h>
#include <gx2/clear.h>
#include <gx2/mem.h>
#include <gx2/event.h>
#include <gx2r/surface.h>
#include <gx2r/buffer.h>
#include <gx2r/draw.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
static void WIIU_SDL_SetGX2BlendMode(SDL_BlendMode mode);
int WIIU_SDL_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * srcrect, const SDL_FRect * dstrect)
{
WIIU_RenderData *data = (WIIU_RenderData *) renderer->driverdata;
WIIU_TextureData *tdata = (WIIU_TextureData *) texture->driverdata;
GX2RBuffer *a_position, *a_texCoord;
WIIUVec2 *a_position_vals, *a_texCoord_vals;
float x_min, y_min, x_max, y_max;
if (texture->access & SDL_TEXTUREACCESS_TARGET) {
GX2RInvalidateSurface(&tdata->texture.surface, 0, 0);
}
/* Update texture rendering state */
WIIU_TextureStartRendering(data, tdata);
/* Allocate attribute buffers */
a_position = WIIU_AllocRenderData(data, (GX2RBuffer) {
.flags =
GX2R_RESOURCE_BIND_VERTEX_BUFFER |
GX2R_RESOURCE_USAGE_CPU_WRITE,
.elemSize = sizeof(WIIUVec2), // float x/y for each corner
.elemCount = 4, // 4 corners
});
a_texCoord = WIIU_AllocRenderData(data, (GX2RBuffer) {
.flags =
GX2R_RESOURCE_BIND_VERTEX_BUFFER |
GX2R_RESOURCE_USAGE_CPU_WRITE,
.elemSize = sizeof(WIIUVec2),
.elemCount = 4, // 4 corners
});
/* Compute vertex points */
x_min = renderer->viewport.x + dstrect->x;
y_min = renderer->viewport.y + dstrect->y;
x_max = renderer->viewport.x + dstrect->x + dstrect->w;
y_max = renderer->viewport.y + dstrect->y + dstrect->h;
/* Save them */
a_position_vals = GX2RLockBufferEx(a_position, 0);
a_position_vals[0] = (WIIUVec2){.x = x_min, .y = y_max};
a_position_vals[1] = (WIIUVec2){.x = x_max, .y = y_max};
a_position_vals[2] = (WIIUVec2){.x = x_max, .y = y_min};
a_position_vals[3] = (WIIUVec2){.x = x_min, .y = y_min};
GX2RUnlockBufferEx(a_position, 0);
/* Compute texture coords */
a_texCoord_vals = GX2RLockBufferEx(a_texCoord, 0);
a_texCoord_vals[0] = (WIIUVec2) {
.x = srcrect->x,
.y = texture->h - srcrect->y - srcrect->h,
};
a_texCoord_vals[1] = (WIIUVec2) {
.x = srcrect->x + srcrect->w,
.y = texture->h - srcrect->y - srcrect->h,
};
a_texCoord_vals[2] = (WIIUVec2) {
.x = srcrect->x + srcrect->w,
.y = texture->h - srcrect->y,
};
a_texCoord_vals[3] = (WIIUVec2) {
.x = srcrect->x,
.y = texture->h - srcrect->y,
};
GX2RUnlockBufferEx(a_texCoord, 0);
/* Render */
wiiuSetTextureShader();
GX2SetPixelTexture(&tdata->texture, 0);
GX2SetPixelSampler(&tdata->sampler, 0);
GX2RSetAttributeBuffer(a_position, 0, a_position->elemSize, 0);
GX2RSetAttributeBuffer(a_texCoord, 1, a_texCoord->elemSize, 0);
GX2SetVertexUniformReg(wiiuTextureShader.vertexShader->uniformVars[0].offset, 4, (uint32_t *)&data->u_viewSize);
GX2SetVertexUniformReg(wiiuTextureShader.vertexShader->uniformVars[1].offset, 4, (uint32_t *)&tdata->u_texSize);
GX2SetPixelUniformReg(wiiuTextureShader.pixelShader->uniformVars[0].offset, 4, (uint32_t *)&tdata->u_mod);
WIIU_SDL_SetGX2BlendMode(texture->blendMode);
GX2DrawEx(GX2_PRIMITIVE_MODE_QUADS, 4, 0, 1);
return 0;
}
int WIIU_SDL_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * srcrect, const SDL_FRect * dstrect,
const double angle, const SDL_FPoint * center, const SDL_RendererFlip flip)
{
WIIU_RenderData *data = (WIIU_RenderData *) renderer->driverdata;
WIIU_TextureData *tdata = (WIIU_TextureData *) texture->driverdata;
GX2RBuffer *a_position, *a_texCoord;
WIIUVec2 *a_position_vals, *a_texCoord_vals;
/* Compute real vertex points */
float x_min = renderer->viewport.x + dstrect->x;
float y_min = renderer->viewport.y + dstrect->y;
float x_max = x_min + dstrect->w;
float y_max = y_min + dstrect->h;
float cx = x_min + center->x;
float cy = y_min + center->y;
double r = angle * (M_PI / 180.0);
WIIUVec2 rvb[4] = {
{
.x = (flip & SDL_FLIP_HORIZONTAL) ? x_max : x_min,
.y = (flip & SDL_FLIP_VERTICAL) ? y_min : y_max,
},
{
.x = (flip & SDL_FLIP_HORIZONTAL) ? x_min : x_max,
.y = (flip & SDL_FLIP_VERTICAL) ? y_min : y_max,
},
{
.x = (flip & SDL_FLIP_HORIZONTAL) ? x_min : x_max,
.y = (flip & SDL_FLIP_VERTICAL) ? y_max : y_min,
},
{
.x = (flip & SDL_FLIP_HORIZONTAL) ? x_max : x_min,
.y = (flip & SDL_FLIP_VERTICAL) ? y_max : y_min,
},
};
if (texture->access & SDL_TEXTUREACCESS_TARGET) {
GX2RInvalidateSurface(&tdata->texture.surface, 0, 0);
}
/* Update texture rendering state */
WIIU_TextureStartRendering(data, tdata);
/* Allocate attribute buffers */
a_position = WIIU_AllocRenderData(data, (GX2RBuffer) {
.flags =
GX2R_RESOURCE_BIND_VERTEX_BUFFER |
GX2R_RESOURCE_USAGE_CPU_WRITE,
.elemSize = sizeof(WIIUVec2), // float x/y for each corner
.elemCount = 4, // 4 corners
});
a_texCoord = WIIU_AllocRenderData(data, (GX2RBuffer) {
.flags =
GX2R_RESOURCE_BIND_VERTEX_BUFFER |
GX2R_RESOURCE_USAGE_CPU_WRITE,
.elemSize = sizeof(WIIUVec2), // float x/y for each corner
.elemCount = 4, // 4 corners
});
/* Save vertex points */
a_position_vals = GX2RLockBufferEx(a_position, 0);
for (int i = 0; i < 4; i++) {
a_position_vals[i] = (WIIUVec2) {
.x = cx + (SDL_cos(r) * (rvb[i].x - cx) - SDL_sin(r) * (rvb[i].y - cy)),
.y = cy + (SDL_cos(r) * (rvb[i].y - cy) + SDL_sin(r) * (rvb[i].x - cx)),
};
}
GX2RUnlockBufferEx(a_position, 0);
/* Compute texture coords */
a_texCoord_vals = GX2RLockBufferEx(a_texCoord, 0);
a_texCoord_vals[0] = (WIIUVec2) {
.x = srcrect->x,
.y = texture->h - srcrect->y - srcrect->h,
};
a_texCoord_vals[1] = (WIIUVec2) {
.x = srcrect->x + srcrect->w,
.y = texture->h - srcrect->y - srcrect->h,
};
a_texCoord_vals[2] = (WIIUVec2) {
.x = srcrect->x + srcrect->w,
.y = texture->h - srcrect->y,
};
a_texCoord_vals[3] = (WIIUVec2) {
.x = srcrect->x,
.y = texture->h - srcrect->y,
};
GX2RUnlockBufferEx(a_texCoord, 0);
/* Render */
wiiuSetTextureShader();
GX2SetPixelTexture(&tdata->texture, 0);
GX2SetPixelSampler(&tdata->sampler, 0);
GX2RSetAttributeBuffer(a_position, 0, a_position->elemSize, 0);
GX2RSetAttributeBuffer(a_texCoord, 1, a_texCoord->elemSize, 0);
GX2SetVertexUniformReg(wiiuTextureShader.vertexShader->uniformVars[0].offset, 4, (uint32_t *)&data->u_viewSize);
GX2SetVertexUniformReg(wiiuTextureShader.vertexShader->uniformVars[1].offset, 4, (uint32_t *)&tdata->u_texSize);
GX2SetPixelUniformReg(wiiuTextureShader.pixelShader->uniformVars[0].offset, 4, (uint32_t *)&tdata->u_mod);
WIIU_SDL_SetGX2BlendMode(texture->blendMode);
GX2DrawEx(GX2_PRIMITIVE_MODE_QUADS, 4, 0, 1);
return 0;
}
int WIIU_SDL_RenderDrawPoints(SDL_Renderer * renderer, const SDL_FPoint * points,
int count)
{
WIIU_RenderData *data = (WIIU_RenderData *) renderer->driverdata;
GX2RBuffer *a_position;
WIIUVec2 *a_position_vals;
/* Compute colours */
WIIUVec4 u_colour = {
.r = (float)renderer->r / 255.0f,
.g = (float)renderer->g / 255.0f,
.b = (float)renderer->b / 255.0f,
.a = (float)renderer->a / 255.0f,
};
/* Allocate attribute buffers */
a_position = WIIU_AllocRenderData(data, (GX2RBuffer) {
.flags =
GX2R_RESOURCE_BIND_VERTEX_BUFFER |
GX2R_RESOURCE_USAGE_CPU_WRITE,
.elemSize = sizeof(WIIUVec2), /* float x/y for each point */
.elemCount = count,
});
/* Compute vertex positions */
a_position_vals = GX2RLockBufferEx(a_position, 0);
for (int i = 0; i < count; ++i) {
a_position_vals[i] = (WIIUVec2) {
.x = (float)renderer->viewport.x + points[i].x,
.y = (float)renderer->viewport.y + points[i].y,
};
}
GX2RUnlockBufferEx(a_position, 0);
/* Render points */
wiiuSetColorShader();
GX2RSetAttributeBuffer(a_position, 0, a_position->elemSize, 0);
GX2SetVertexUniformReg(wiiuColorShader.vertexShader->uniformVars[0].offset, 4, (uint32_t *)&data->u_viewSize);
GX2SetPixelUniformReg(wiiuColorShader.pixelShader->uniformVars[0].offset, 4, (uint32_t *)&u_colour);
WIIU_SDL_SetGX2BlendMode(renderer->blendMode);
GX2DrawEx(GX2_PRIMITIVE_MODE_POINTS, count, 0, 1);
return 0;
}
int WIIU_SDL_RenderDrawLines(SDL_Renderer * renderer, const SDL_FPoint * points,
int count)
{
WIIU_RenderData *data = (WIIU_RenderData *) renderer->driverdata;
GX2RBuffer *a_position;
WIIUVec2 *a_position_vals;
/* Compute colours */
WIIUVec4 u_colour = {
.r = (float)renderer->r / 255.0f,
.g = (float)renderer->g / 255.0f,
.b = (float)renderer->b / 255.0f,
.a = (float)renderer->a / 255.0f,
};
/* Allocate attribute buffers */
a_position = WIIU_AllocRenderData(data, (GX2RBuffer) {
.flags =
GX2R_RESOURCE_BIND_VERTEX_BUFFER |
GX2R_RESOURCE_USAGE_CPU_WRITE,
.elemSize = sizeof(WIIUVec2), /* float x/y for each point */
.elemCount = count,
});
/* Compute vertex positions */
a_position_vals = GX2RLockBufferEx(a_position, 0);
for (int i = 0; i < count; ++i) {
a_position_vals[i] = (WIIUVec2) {
.x = (float)renderer->viewport.x + points[i].x,
.y = (float)renderer->viewport.y + points[i].y,
};
}
GX2RUnlockBufferEx(a_position, 0);
/* Render lines */
wiiuSetColorShader();
GX2RSetAttributeBuffer(a_position, 0, a_position->elemSize, 0);
GX2SetVertexUniformReg(wiiuColorShader.vertexShader->uniformVars[0].offset, 4, (uint32_t *)&data->u_viewSize);
GX2SetPixelUniformReg(wiiuColorShader.pixelShader->uniformVars[0].offset, 4, (uint32_t *)&u_colour);
WIIU_SDL_SetGX2BlendMode(renderer->blendMode);
GX2DrawEx(GX2_PRIMITIVE_MODE_LINE_STRIP, count, 0, 1);
return 0;
}
int WIIU_SDL_RenderFillRects(SDL_Renderer * renderer, const SDL_FRect * rects, int count)
{
WIIU_RenderData *data = (WIIU_RenderData *) renderer->driverdata;
GX2RBuffer *a_position;
WIIUVec2 *a_position_vals;
/* Compute colours */
WIIUVec4 u_colour = {
.r = (float)renderer->r / 255.0f,
.g = (float)renderer->g / 255.0f,
.b = (float)renderer->b / 255.0f,
.a = (float)renderer->a / 255.0f,
};
/* Compute vertex pos */
float vx = (float)renderer->viewport.x;
float vy = (float)renderer->viewport.y;
/* Allocate attribute buffers */
a_position = WIIU_AllocRenderData(data, (GX2RBuffer) {
.flags =
GX2R_RESOURCE_BIND_VERTEX_BUFFER |
GX2R_RESOURCE_USAGE_CPU_WRITE,
.elemSize = sizeof(WIIUVec2), // x/y float per corner
.elemCount = 4 * count, // 4 corners per square
});
/* Compute vertex positions */
a_position_vals = GX2RLockBufferEx(a_position, 0);
for (int i = 0; i < count; ++i) {
a_position_vals[i*4 + 0] = (WIIUVec2) {
.x = vx + rects[i].x,
.y = vy + rects[i].y,
};
a_position_vals[i*4 + 1] = (WIIUVec2) {
.x = vx + rects[i].x + rects[i].w,
.y = vy + rects[i].y,
};
a_position_vals[i*4 + 2] = (WIIUVec2) {
.x = vx + rects[i].x + rects[i].w,
.y = vy + rects[i].y + rects[i].h,
};
a_position_vals[i*4 + 3] = (WIIUVec2) {
.x = vx + rects[i].x,
.y = vy + rects[i].y + rects[i].h,
};
}
GX2RUnlockBufferEx(a_position, 0);
/* Render rects */
wiiuSetColorShader();
GX2RSetAttributeBuffer(a_position, 0, a_position->elemSize, 0);
GX2SetVertexUniformReg(wiiuColorShader.vertexShader->uniformVars[0].offset, 4, (uint32_t *)&data->u_viewSize);
GX2SetPixelUniformReg(wiiuColorShader.pixelShader->uniformVars[0].offset, 4, (uint32_t *)&u_colour);
WIIU_SDL_SetGX2BlendMode(renderer->blendMode);
GX2DrawEx(GX2_PRIMITIVE_MODE_QUADS, 4 * count, 0, 1);
return 0;
}
int WIIU_SDL_RenderClear(SDL_Renderer * renderer)
{
WIIU_RenderData* data = (WIIU_RenderData*) renderer->driverdata;
SDL_Texture* target = WIIU_GetRenderTarget(renderer);
WIIU_TextureData* tdata = (WIIU_TextureData*) target->driverdata;
GX2ClearColor(&tdata->cbuf,
(float)renderer->r / 255.0f,
(float)renderer->g / 255.0f,
(float)renderer->b / 255.0f,
(float)renderer->a / 255.0f);
/* Restore SDL context state */
GX2SetContextState(data->ctx);
return 0;
}
static void WIIU_SDL_SetGX2BlendMode(SDL_BlendMode mode)
{
if (mode == SDL_BLENDMODE_NONE) {
GX2SetColorControl(GX2_LOGIC_OP_COPY, 0x00, FALSE, TRUE);
} else if (mode == SDL_BLENDMODE_BLEND) {
GX2SetColorControl(GX2_LOGIC_OP_COPY, 0xFF, FALSE, TRUE);
GX2SetBlendControl(GX2_RENDER_TARGET_0,
/* RGB = [srcRGB * srcA] + [dstRGB * (1-srcA)] */
GX2_BLEND_MODE_SRC_ALPHA, GX2_BLEND_MODE_INV_SRC_ALPHA,
GX2_BLEND_COMBINE_MODE_ADD,
TRUE,
/* A = [srcA * 1] + [dstA * (1-srcA)] */
GX2_BLEND_MODE_ONE, GX2_BLEND_MODE_INV_SRC_ALPHA,
GX2_BLEND_COMBINE_MODE_ADD);
} else if (mode == SDL_BLENDMODE_ADD) {
GX2SetColorControl(GX2_LOGIC_OP_COPY, 0xFF, FALSE, TRUE);
GX2SetBlendControl(GX2_RENDER_TARGET_0,
/* RGB = [srcRGB * srcA] + [dstRGB * 1] */
GX2_BLEND_MODE_SRC_ALPHA, GX2_BLEND_MODE_ONE,
GX2_BLEND_COMBINE_MODE_ADD,
TRUE,
/* A = [srcA * 0] + [dstA * 1] */
GX2_BLEND_MODE_ZERO, GX2_BLEND_MODE_ONE,
GX2_BLEND_COMBINE_MODE_ADD);
} else if (mode == SDL_BLENDMODE_MOD) {
GX2SetColorControl(GX2_LOGIC_OP_COPY, 0xFF, FALSE, TRUE);
GX2SetBlendControl(GX2_RENDER_TARGET_0,
/* RGB = [srcRGB * dstRGB] + [dstRGB * 0]) */
GX2_BLEND_MODE_DST_COLOR, GX2_BLEND_MODE_ZERO,
GX2_BLEND_COMBINE_MODE_ADD,
TRUE,
/* A = [srcA * 0] + [dstA * 1] */
GX2_BLEND_MODE_ZERO, GX2_BLEND_MODE_ONE,
GX2_BLEND_COMBINE_MODE_ADD);
}
}
#endif /* SDL_VIDEO_RENDER_WIIU */

View File

@ -2,6 +2,7 @@
Simple DirectMedia Layer
Copyright (C) 2018-2019 Ash Logan <ash@heyquark.com>
Copyright (C) 2018-2019 Roberto Van Eeden <r.r.qwertyuiop.r.r@gmail.com>
Copyright (C) 2022 GaryOderNichts <garyodernichts@gmail.com>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@ -23,9 +24,6 @@
#if SDL_VIDEO_RENDER_WIIU
#include "../../video/wiiu/SDL_wiiuvideo.h"
#include "../../video/wiiu/wiiu_shaders.h"
#include "../SDL_sysrender.h"
#include "SDL_hints.h"
#include "SDL_render_wiiu.h"
@ -35,8 +33,6 @@
#include <malloc.h>
SDL_RenderDriver WIIU_RenderDriver;
SDL_Renderer *WIIU_SDL_CreateRenderer(SDL_Window * window, Uint32 flags)
{
SDL_Renderer *renderer;
@ -50,29 +46,26 @@ SDL_Renderer *WIIU_SDL_CreateRenderer(SDL_Window * window, Uint32 flags)
data = (WIIU_RenderData *) SDL_calloc(1, sizeof(*data));
if (!data) {
WIIU_SDL_DestroyRenderer(renderer);
SDL_free(renderer);
SDL_OutOfMemory();
return NULL;
}
/* Setup renderer functions */
renderer->WindowEvent = WIIU_SDL_WindowEvent;
renderer->GetOutputSize = WIIU_SDL_GetOutputSize;
renderer->SupportsBlendMode = WIIU_SDL_SupportsBlendMode;
renderer->CreateTexture = WIIU_SDL_CreateTexture;
renderer->SetTextureColorMod = WIIU_SDL_SetTextureColorMod;
renderer->SetTextureAlphaMod = WIIU_SDL_SetTextureAlphaMod;
renderer->UpdateTexture = WIIU_SDL_UpdateTexture;
renderer->LockTexture = WIIU_SDL_LockTexture;
renderer->UnlockTexture = WIIU_SDL_UnlockTexture;
renderer->SetTextureScaleMode = WIIU_SDL_SetTextureScaleMode;
renderer->SetRenderTarget = WIIU_SDL_SetRenderTarget;
renderer->UpdateViewport = WIIU_SDL_UpdateViewport;
renderer->UpdateClipRect = WIIU_SDL_UpdateClipRect;
renderer->RenderClear = WIIU_SDL_RenderClear;
renderer->RenderDrawPoints = WIIU_SDL_RenderDrawPoints;
renderer->RenderDrawLines = WIIU_SDL_RenderDrawLines;
renderer->RenderFillRects = WIIU_SDL_RenderFillRects;
renderer->RenderCopy = WIIU_SDL_RenderCopy;
renderer->RenderCopyEx = WIIU_SDL_RenderCopyEx;
renderer->QueueSetViewport = WIIU_SDL_QueueSetViewport;
renderer->QueueSetDrawColor = WIIU_SDL_QueueSetDrawColor;
renderer->QueueDrawPoints = WIIU_SDL_QueueDrawPoints;
renderer->QueueDrawLines = WIIU_SDL_QueueDrawLines;
renderer->QueueGeometry = WIIU_SDL_QueueGeometry;
renderer->RunCommandQueue = WIIU_SDL_RunCommandQueue;
renderer->RenderReadPixels = WIIU_SDL_RenderReadPixels;
renderer->RenderPresent = WIIU_SDL_RenderPresent;
renderer->DestroyTexture = WIIU_SDL_DestroyTexture;
@ -82,8 +75,7 @@ SDL_Renderer *WIIU_SDL_CreateRenderer(SDL_Window * window, Uint32 flags)
renderer->window = window;
/* Prepare shaders */
wiiuInitTextureShader();
wiiuInitColorShader();
WIIU_SDL_CreateShaders();
/* List of attibutes to free after render */
data->listfree = NULL;
@ -103,6 +95,12 @@ SDL_Renderer *WIIU_SDL_CreateRenderer(SDL_Window * window, Uint32 flags)
GX2SetDepthOnlyControl(FALSE, FALSE, GX2_COMPARE_FUNC_NEVER);
GX2SetCullOnlyControl(GX2_FRONT_FACE_CCW, FALSE, FALSE);
data->drawState.blendMode = SDL_BLENDMODE_INVALID;
data->drawState.shader = SHADER_INVALID;
data->drawState.projectionMatrix[3][0] = -1.0f;
data->drawState.projectionMatrix[3][1] = 1.0f;
data->drawState.projectionMatrix[3][3] = 1.0f;
/* Make a texture for the window */
WIIU_SDL_CreateWindowTex(renderer, window);
@ -112,6 +110,26 @@ SDL_Renderer *WIIU_SDL_CreateRenderer(SDL_Window * window, Uint32 flags)
return renderer;
}
SDL_bool WIIU_SDL_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode)
{
SDL_BlendFactor srcColorFactor = SDL_GetBlendModeSrcColorFactor(blendMode);
SDL_BlendFactor srcAlphaFactor = SDL_GetBlendModeSrcAlphaFactor(blendMode);
SDL_BlendOperation colorOperation = SDL_GetBlendModeColorOperation(blendMode);
SDL_BlendFactor dstColorFactor = SDL_GetBlendModeDstColorFactor(blendMode);
SDL_BlendFactor dstAlphaFactor = SDL_GetBlendModeDstAlphaFactor(blendMode);
SDL_BlendOperation alphaOperation = SDL_GetBlendModeAlphaOperation(blendMode);
if (WIIU_SDL_GetBlendMode(srcColorFactor) == -1 ||
WIIU_SDL_GetBlendMode(srcAlphaFactor) == -1 ||
WIIU_SDL_GetBlendCombineMode(colorOperation) == -1 ||
WIIU_SDL_GetBlendMode(dstColorFactor) == -1 ||
WIIU_SDL_GetBlendMode(dstAlphaFactor) == -1 ||
WIIU_SDL_GetBlendCombineMode(alphaOperation) == -1) {
return SDL_FALSE;
}
return SDL_TRUE;
}
void WIIU_SDL_CreateWindowTex(SDL_Renderer * renderer, SDL_Window * window)
{
WIIU_RenderData *data = (WIIU_RenderData *) renderer->driverdata;
@ -140,7 +158,6 @@ void WIIU_SDL_CreateWindowTex(SDL_Renderer * renderer, SDL_Window * window)
/* Allocate a buffer for the window */
data->windowTex = (SDL_Texture) {
.format = SDL_PIXELFORMAT_RGBA8888,
.r = 255, .g = 255, .b = 255, .a = 255,
.driverdata = WIIU_TEXTURE_MEM1_MAGIC,
.scaleMode = s_mode,
};
@ -162,21 +179,11 @@ int WIIU_SDL_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture)
/* Wait for the texture rendering to finish */
WIIU_TextureCheckWaitRendering(data, tdata);
/* Update u_viewSize */
data->u_viewSize = (WIIUVec4) {
.x = (float)tdata->cbuf.surface.width,
.y = (float)tdata->cbuf.surface.height,
};
data->drawState.viewportDirty = SDL_TRUE;
/* Update context state */
GX2SetColorBuffer(&tdata->cbuf, GX2_RENDER_TARGET_0);
/* These may be unnecessary - see SDL_render.c: SDL_SetRenderTarget's calls
to UpdateViewport and UpdateClipRect. TODO for once the render is
basically working */
GX2SetViewport(0, 0, (float)tdata->cbuf.surface.width, (float)tdata->cbuf.surface.height, 0.0f, 1.0f);
GX2SetScissor(0, 0, (float)tdata->cbuf.surface.width, (float)tdata->cbuf.surface.height);
return 0;
}
@ -191,8 +198,7 @@ void WIIU_SDL_DestroyRenderer(SDL_Renderer * renderer)
free(data->ctx);
wiiuFreeColorShader();
wiiuFreeTextureShader();
WIIU_SDL_DestroyShaders();
SDL_free(data);
SDL_free(renderer);
@ -234,34 +240,25 @@ SDL_RenderDriver WIIU_RenderDriver =
.info = {
.name = "WiiU GX2",
.flags = SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_TARGETTEXTURE,
.num_texture_formats = 13, //21,
.num_texture_formats = 15,
.texture_formats = {
/* TODO: Alpha-less (X) formats */
SDL_PIXELFORMAT_RGBA8888,
// SDL_PIXELFORMAT_RGBX8888,
SDL_PIXELFORMAT_RGBX8888,
// SDL_PIXELFORMAT_RGB444,
SDL_PIXELFORMAT_ARGB4444,
SDL_PIXELFORMAT_RGBA4444,
SDL_PIXELFORMAT_ABGR4444,
SDL_PIXELFORMAT_BGRA4444,
// SDL_PIXELFORMAT_RGB555,
SDL_PIXELFORMAT_ARGB1555,
// SDL_PIXELFORMAT_BGR555,
SDL_PIXELFORMAT_ABGR1555,
SDL_PIXELFORMAT_RGBA5551,
SDL_PIXELFORMAT_BGRA5551,
/* TODO: RGB565 doesn't seem to work right, endian issue? */
// SDL_PIXELFORMAT_RGB565,
// SDL_PIXELFORMAT_BGR565,
SDL_PIXELFORMAT_ARGB8888,
SDL_PIXELFORMAT_BGRA8888,
// SDL_PIXELFORMAT_BGRX8888,
SDL_PIXELFORMAT_BGRX8888,
SDL_PIXELFORMAT_ABGR8888,
// SDL_PIXELFORMAT_BGR888,
SDL_PIXELFORMAT_ARGB2101010,
},

View File

@ -2,6 +2,7 @@
Simple DirectMedia Layer
Copyright (C) 2018-2019 Ash Logan <ash@heyquark.com>
Copyright (C) 2018-2019 Roberto Van Eeden <r.r.qwertyuiop.r.r@gmail.com>
Copyright (C) 2022 GaryOderNichts <garyodernichts@gmail.com>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@ -24,47 +25,29 @@
#ifndef SDL_render_wiiu_h
#define SDL_render_wiiu_h
#if SDL_VIDEO_RENDER_WIIU
#include "../SDL_sysrender.h"
#include "SDL_pixels.h"
#include "SDL_shaders_wiiu.h"
#include <gx2r/buffer.h>
#include <gx2/context.h>
#include <gx2/sampler.h>
#include <gx2/texture.h>
#include <gx2/surface.h>
#include <gx2/event.h>
#include <gx2/utils.h>
/* Driver internal data structures */
typedef struct WIIUVec2 WIIUVec2;
typedef struct WIIUVec3 WIIUVec3;
typedef struct WIIUVec4 WIIUVec4;
typedef struct WIIUPixFmt WIIUPixFmt;
typedef struct WIIU_PixFmt WIIU_PixFmt;
typedef struct WIIU_RenderAllocData WIIU_RenderAllocData;
typedef struct WIIU_TextureDrawData WIIU_TextureDrawData;
typedef struct WIIU_DrawState WIIU_DrawState;
typedef struct WIIU_RenderData WIIU_RenderData;
typedef struct WIIU_TextureData WIIU_TextureData;
struct WIIUVec2
{
union { float x, r; };
union { float y, g; };
};
struct WIIUVec3
{
union { float x, r; };
union { float y, g; };
union { float z, b; };
};
struct WIIUVec4
{
union { float x, r; };
union { float y, g; };
union { float z, b; };
union { float w, a; };
};
struct WIIUPixFmt
struct WIIU_PixFmt
{
GX2SurfaceFormat fmt;
uint32_t compMap;
@ -82,13 +65,33 @@ struct WIIU_TextureDrawData
WIIU_TextureData *texdata;
};
struct WIIU_DrawState
{
SDL_Texture *target;
SDL_Texture *texture;
SDL_Rect viewport;
SDL_bool viewportDirty;
int drawableWidth, drawableHeight;
float projectionMatrix[4][4];
SDL_bool cliprectEnabledDirty;
SDL_bool cliprectEnabled;
SDL_bool cliprectDirty;
SDL_Rect cliprect;
SDL_BlendMode blendMode;
WIIU_ShaderType shader;
};
struct WIIU_RenderData
{
GX2ContextState *ctx;
WIIU_RenderAllocData *listfree;
WIIU_TextureDrawData *listdraw;
WIIUVec4 u_viewSize;
SDL_Texture windowTex;
WIIU_DrawState drawState;
};
struct WIIU_TextureData
@ -96,8 +99,6 @@ struct WIIU_TextureData
GX2Sampler sampler;
GX2Texture texture;
GX2ColorBuffer cbuf;
WIIUVec4 u_texSize;
WIIUVec4 u_mod;
int isRendering;
};
@ -108,33 +109,25 @@ struct WIIU_TextureData
SDL_Renderer *WIIU_SDL_CreateRenderer(SDL_Window * window, Uint32 flags);
void WIIU_SDL_WindowEvent(SDL_Renderer * renderer,
const SDL_WindowEvent *event);
int WIIU_SDL_GetOutputSize(SDL_Renderer * renderer, int *w, int *h);
SDL_bool WIIU_SDL_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode);
int WIIU_SDL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture);
int WIIU_SDL_SetTextureColorMod(SDL_Renderer * renderer,
SDL_Texture * texture);
int WIIU_SDL_SetTextureAlphaMod(SDL_Renderer * renderer,
SDL_Texture * texture);
int WIIU_SDL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * rect, const void *pixels,
int pitch);
int WIIU_SDL_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * rect, void **pixels, int *pitch);
void WIIU_SDL_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture);
void WIIU_SDL_SetTextureScaleMode(SDL_Renderer * renderer, SDL_Texture * texture, SDL_ScaleMode scaleMode);
int WIIU_SDL_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture);
int WIIU_SDL_UpdateViewport(SDL_Renderer * renderer);
int WIIU_SDL_UpdateClipRect(SDL_Renderer * renderer);
int WIIU_SDL_RenderClear(SDL_Renderer * renderer);
int WIIU_SDL_RenderDrawPoints(SDL_Renderer * renderer,
const SDL_FPoint * points, int count);
int WIIU_SDL_RenderDrawLines(SDL_Renderer * renderer,
const SDL_FPoint * points, int count);
int WIIU_SDL_RenderFillRects(SDL_Renderer * renderer,
const SDL_FRect * rects, int count);
int WIIU_SDL_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * srcrect, const SDL_FRect * dstrect);
int WIIU_SDL_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * srcrect, const SDL_FRect * dstrect,
const double angle, const SDL_FPoint * center, const SDL_RendererFlip flip);
int WIIU_SDL_QueueSetViewport(SDL_Renderer * renderer, SDL_RenderCommand * cmd);
int WIIU_SDL_QueueSetDrawColor(SDL_Renderer * renderer, SDL_RenderCommand * cmd);
int WIIU_SDL_QueueDrawPoints(SDL_Renderer * renderer, SDL_RenderCommand * cmd, const SDL_FPoint * points, int count);
int WIIU_SDL_QueueDrawLines(SDL_Renderer * renderer, SDL_RenderCommand * cmd, const SDL_FPoint * points, int count);
int WIIU_SDL_QueueGeometry(SDL_Renderer * renderer, SDL_RenderCommand * cmd, SDL_Texture * texture,
const float * xy, int xy_stride, const SDL_Color * color, int color_stride, const float * uv, int uv_stride,
int num_vertices, const void * indices, int num_indices, int size_indices,
float scale_x, float scale_y);
int WIIU_SDL_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertices, size_t vertsize);
int WIIU_SDL_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
Uint32 format, void * pixels, int pitch);
void WIIU_SDL_RenderPresent(SDL_Renderer * renderer);
@ -213,105 +206,106 @@ static inline SDL_Texture * WIIU_GetRenderTarget(SDL_Renderer* renderer)
return &data->windowTex;
}
static inline WIIUPixFmt SDLFormatToWIIUFormat(Uint32 format)
static inline WIIU_PixFmt WIIU_SDL_GetPixFmt(Uint32 format)
{
WIIUPixFmt outFmt = { /* sane defaults? */
.fmt = GX2_SURFACE_FORMAT_UNORM_R8_G8_B8_A8,
.compMap = 0x00010203,
};
WIIU_PixFmt outFmt = { .fmt = -1, .compMap = 0 };
switch (format) {
/* packed16 formats: 4 bits/channel */
case SDL_PIXELFORMAT_RGB444: /* aka XRGB4444 */
case SDL_PIXELFORMAT_ARGB4444: {
outFmt.fmt = GX2_SURFACE_FORMAT_UNORM_R4_G4_B4_A4;
outFmt.compMap = 0x01020300;
outFmt.compMap = GX2_COMP_MAP(GX2_SQ_SEL_G, GX2_SQ_SEL_B, GX2_SQ_SEL_A, GX2_SQ_SEL_R);
break;
}
case SDL_PIXELFORMAT_RGBA4444: {
outFmt.fmt = GX2_SURFACE_FORMAT_UNORM_R4_G4_B4_A4;
outFmt.compMap = 0x00010203;
outFmt.compMap = GX2_COMP_MAP(GX2_SQ_SEL_R, GX2_SQ_SEL_G, GX2_SQ_SEL_B, GX2_SQ_SEL_A);
break;
}
case SDL_PIXELFORMAT_ABGR4444: {
outFmt.fmt = GX2_SURFACE_FORMAT_UNORM_R4_G4_B4_A4;
outFmt.compMap = 0x03020100;
outFmt.compMap = GX2_COMP_MAP(GX2_SQ_SEL_A, GX2_SQ_SEL_B, GX2_SQ_SEL_G, GX2_SQ_SEL_R);
break;
}
case SDL_PIXELFORMAT_BGRA4444: {
outFmt.fmt = GX2_SURFACE_FORMAT_UNORM_R4_G4_B4_A4;
outFmt.compMap = 0x02010003;
outFmt.compMap = GX2_COMP_MAP(GX2_SQ_SEL_B, GX2_SQ_SEL_G, GX2_SQ_SEL_R, GX2_SQ_SEL_A);
break;
}
/* packed16 formats: 5 bits/channel */
case SDL_PIXELFORMAT_RGB555: /* aka XRGB1555 */
case SDL_PIXELFORMAT_ARGB1555: {
outFmt.fmt = GX2_SURFACE_FORMAT_UNORM_R5_G5_B5_A1;
outFmt.compMap = 0x01020300;
outFmt.compMap = GX2_COMP_MAP(GX2_SQ_SEL_G, GX2_SQ_SEL_B, GX2_SQ_SEL_A, GX2_SQ_SEL_R);
break;
}
case SDL_PIXELFORMAT_BGR555: /* aka XRGB1555 */
case SDL_PIXELFORMAT_ABGR1555: {
outFmt.fmt = GX2_SURFACE_FORMAT_UNORM_R5_G5_B5_A1;
outFmt.compMap = 0x03020100;
outFmt.compMap = GX2_COMP_MAP(GX2_SQ_SEL_A, GX2_SQ_SEL_B, GX2_SQ_SEL_G, GX2_SQ_SEL_R);
break;
}
case SDL_PIXELFORMAT_RGBA5551: {
outFmt.fmt = GX2_SURFACE_FORMAT_UNORM_R5_G5_B5_A1;
outFmt.compMap = 0x00010203;
outFmt.compMap = GX2_COMP_MAP(GX2_SQ_SEL_R, GX2_SQ_SEL_G, GX2_SQ_SEL_B, GX2_SQ_SEL_A);
break;
}
case SDL_PIXELFORMAT_BGRA5551: {
outFmt.fmt = GX2_SURFACE_FORMAT_UNORM_R5_G5_B5_A1;
outFmt.compMap = 0x02010003;
outFmt.compMap = GX2_COMP_MAP(GX2_SQ_SEL_B, GX2_SQ_SEL_G, GX2_SQ_SEL_R, GX2_SQ_SEL_A);
break;
}
/* packed16 formats: 565 */
case SDL_PIXELFORMAT_RGB565: {
outFmt.fmt = GX2_SURFACE_FORMAT_UNORM_R5_G6_B5;
outFmt.compMap = 0x00010203;
outFmt.compMap = GX2_COMP_MAP(GX2_SQ_SEL_R, GX2_SQ_SEL_G, GX2_SQ_SEL_B, GX2_SQ_SEL_A);
break;
}
case SDL_PIXELFORMAT_BGR565: {
outFmt.fmt = GX2_SURFACE_FORMAT_UNORM_R5_G6_B5;
outFmt.compMap = 0x02010003;
outFmt.compMap = GX2_COMP_MAP(GX2_SQ_SEL_B, GX2_SQ_SEL_G, GX2_SQ_SEL_R, GX2_SQ_SEL_A);
break;
}
/* packed32 formats */
case SDL_PIXELFORMAT_RGBA8888:
case SDL_PIXELFORMAT_RGBX8888: {
outFmt.fmt = GX2_SURFACE_FORMAT_UNORM_R8_G8_B8_A8;
outFmt.compMap = 0x00010203;
outFmt.compMap = GX2_COMP_MAP(GX2_SQ_SEL_R, GX2_SQ_SEL_G, GX2_SQ_SEL_B, GX2_SQ_SEL_1);
break;
}
case SDL_PIXELFORMAT_RGBA8888: {
outFmt.fmt = GX2_SURFACE_FORMAT_UNORM_R8_G8_B8_A8;
outFmt.compMap = GX2_COMP_MAP(GX2_SQ_SEL_R, GX2_SQ_SEL_G, GX2_SQ_SEL_B, GX2_SQ_SEL_A);
break;
}
case SDL_PIXELFORMAT_ARGB8888: {
outFmt.fmt = GX2_SURFACE_FORMAT_UNORM_R8_G8_B8_A8;
outFmt.compMap = 0x01020300;
outFmt.compMap = GX2_COMP_MAP(GX2_SQ_SEL_G, GX2_SQ_SEL_B, GX2_SQ_SEL_A, GX2_SQ_SEL_R);
break;
}
case SDL_PIXELFORMAT_BGRA8888:
case SDL_PIXELFORMAT_BGRX8888: {
outFmt.fmt = GX2_SURFACE_FORMAT_UNORM_R8_G8_B8_A8;
outFmt.compMap = 0x02010003;
outFmt.compMap = GX2_COMP_MAP(GX2_SQ_SEL_B, GX2_SQ_SEL_G, GX2_SQ_SEL_R, GX2_SQ_SEL_1);
break;
}
case SDL_PIXELFORMAT_ABGR8888:
case SDL_PIXELFORMAT_BGR888: {
case SDL_PIXELFORMAT_BGRA8888: {
outFmt.fmt = GX2_SURFACE_FORMAT_UNORM_R8_G8_B8_A8;
outFmt.compMap = 0x03020100;
outFmt.compMap = GX2_COMP_MAP(GX2_SQ_SEL_B, GX2_SQ_SEL_G, GX2_SQ_SEL_R, GX2_SQ_SEL_A);
break;
}
case SDL_PIXELFORMAT_ABGR8888: {
outFmt.fmt = GX2_SURFACE_FORMAT_UNORM_R8_G8_B8_A8;
outFmt.compMap = GX2_COMP_MAP(GX2_SQ_SEL_A, GX2_SQ_SEL_B, GX2_SQ_SEL_G, GX2_SQ_SEL_R);
break;
}
case SDL_PIXELFORMAT_ARGB2101010: {
outFmt.fmt = GX2_SURFACE_FORMAT_UNORM_R10_G10_B10_A2;
outFmt.compMap = 0x01020300;
outFmt.compMap = GX2_COMP_MAP(GX2_SQ_SEL_G, GX2_SQ_SEL_B, GX2_SQ_SEL_A, GX2_SQ_SEL_R);
break;
}
default: {
/* TODO return an error */
printf("SDL: WiiU format not recognised (SDL: %08X)\n", format);
outFmt.fmt = -1;
break;
}
}
@ -319,4 +313,52 @@ static inline WIIUPixFmt SDLFormatToWIIUFormat(Uint32 format)
return outFmt;
}
#endif //SDL_render_wiiu_h
static inline GX2BlendMode WIIU_SDL_GetBlendMode(SDL_BlendFactor factor)
{
switch (factor) {
case SDL_BLENDFACTOR_ZERO:
return GX2_BLEND_MODE_ZERO;
case SDL_BLENDFACTOR_ONE:
return GX2_BLEND_MODE_ONE;
case SDL_BLENDFACTOR_SRC_COLOR:
return GX2_BLEND_MODE_SRC_COLOR;
case SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR:
return GX2_BLEND_MODE_INV_SRC_COLOR;
case SDL_BLENDFACTOR_SRC_ALPHA:
return GX2_BLEND_MODE_SRC_ALPHA;
case SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA:
return GX2_BLEND_MODE_INV_SRC_ALPHA;
case SDL_BLENDFACTOR_DST_COLOR:
return GX2_BLEND_MODE_DST_COLOR;
case SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR:
return GX2_BLEND_MODE_INV_DST_COLOR;
case SDL_BLENDFACTOR_DST_ALPHA:
return GX2_BLEND_MODE_DST_ALPHA;
case SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA:
return GX2_BLEND_MODE_INV_DST_COLOR;
default:
return -1;
}
}
static inline GX2BlendCombineMode WIIU_SDL_GetBlendCombineMode(SDL_BlendOperation operation)
{
switch (operation) {
case SDL_BLENDOPERATION_ADD:
return GX2_BLEND_COMBINE_MODE_ADD;
case SDL_BLENDOPERATION_SUBTRACT:
return GX2_BLEND_COMBINE_MODE_SUB;
case SDL_BLENDOPERATION_REV_SUBTRACT:
return GX2_BLEND_COMBINE_MODE_REV_SUB;
case SDL_BLENDOPERATION_MINIMUM:
return GX2_BLEND_COMBINE_MODE_MIN;
case SDL_BLENDOPERATION_MAXIMUM:
return GX2_BLEND_COMBINE_MODE_MAX;
default:
return -1;
}
}
#endif /* SDL_VIDEO_RENDER_WIIU */
#endif /* SDL_render_wiiu_h */

View File

@ -2,6 +2,7 @@
Simple DirectMedia Layer
Copyright (C) 2018-2019 Ash Logan <ash@heyquark.com>
Copyright (C) 2018-2019 Roberto Van Eeden <r.r.qwertyuiop.r.r@gmail.com>
Copyright (C) 2022 GaryOderNichts <garyodernichts@gmail.com>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@ -23,7 +24,6 @@
#if SDL_VIDEO_RENDER_WIIU
#include "../../video/wiiu/wiiu_shaders.h"
#include "../SDL_sysrender.h"
#include "SDL_render_wiiu.h"
@ -37,37 +37,20 @@
#define SCREEN_WIDTH 1280
#define SCREEN_HEIGHT 720
static const WIIUVec4 u_viewSize = {.x = (float)SCREEN_WIDTH, .y = (float)SCREEN_HEIGHT};
static void render_scene(SDL_Renderer * renderer)
void WIIU_SDL_RenderPresent(SDL_Renderer * renderer)
{
WIIU_RenderData *data = (WIIU_RenderData *) renderer->driverdata;
WIIU_TextureData *tdata = (WIIU_TextureData *) data->windowTex.driverdata;
float tex_w = tdata->u_texSize.x;
float tex_h = tdata->u_texSize.y;
Uint32 flags = SDL_GetWindowFlags(renderer->window);
int win_x, win_y, win_w, win_h;
GX2RBuffer *a_position, *a_texCoord;
WIIUVec2 *a_position_vals, *a_texCoord_vals;
/* Allocate attribute buffers */
a_position = WIIU_AllocRenderData(data, (GX2RBuffer) {
.flags =
GX2R_RESOURCE_BIND_VERTEX_BUFFER |
GX2R_RESOURCE_USAGE_CPU_WRITE,
.elemSize = sizeof(WIIUVec2), /* float x/y for each corner */
.elemCount = 4, /* 4 corners */
});
a_texCoord = WIIU_AllocRenderData(data, (GX2RBuffer) {
.flags =
GX2R_RESOURCE_BIND_VERTEX_BUFFER |
GX2R_RESOURCE_USAGE_CPU_WRITE,
.elemSize = sizeof(WIIUVec2), // float x/y for each corner
.elemCount = 4, // 4 corners
});
if (renderer->info.flags & SDL_RENDERER_PRESENTVSYNC) {
/* NOTE watch libwhb's source to ensure this call only does vsync */
WHBGfxBeginRender();
}
/* Calculate and save positions */
if (SDL_GetWindowFlags(renderer->window) & SDL_WINDOW_FULLSCREEN) {
/* Calculate and save positions TODO: make use of the window position */
if (flags & SDL_WINDOW_FULLSCREEN) {
win_x = 0;
win_y = 0;
win_w = SCREEN_WIDTH;
@ -79,68 +62,18 @@ static void render_scene(SDL_Renderer * renderer)
win_y = (SCREEN_HEIGHT - win_h) / 2;
}
a_position_vals = GX2RLockBufferEx(a_position, 0);
a_position_vals[0] = (WIIUVec2) {
.x = win_x, .y = win_y
};
a_position_vals[1] = (WIIUVec2) {
.x = win_x + win_w, .y = win_y
};
a_position_vals[2] = (WIIUVec2) {
.x = win_x + win_w, .y = win_y + win_h
};
a_position_vals[3] = (WIIUVec2) {
.x = win_x, .y = win_y + win_h
};
GX2RUnlockBufferEx(a_position, 0);
/* Compute texture coords */
a_texCoord_vals = GX2RLockBufferEx(a_texCoord, 0);
a_texCoord_vals[0] = (WIIUVec2) {.x = 0.0f, .y = tex_h};
a_texCoord_vals[1] = (WIIUVec2) {.x = tex_w, .y = tex_h};
a_texCoord_vals[2] = (WIIUVec2) {.x = tex_w, .y = 0.0f};
a_texCoord_vals[3] = (WIIUVec2) {.x = 0.0f, .y = 0.0f};
GX2RUnlockBufferEx(a_texCoord, 0);
/* Render the window */
WHBGfxClearColor(0.0f, 0.0f, 0.0f, 1.0f);
wiiuSetTextureShader();
GX2SetVertexUniformReg(wiiuTextureShader.vertexShader->uniformVars[0].offset, 4, (uint32_t *)&u_viewSize);
GX2SetVertexUniformReg(wiiuTextureShader.vertexShader->uniformVars[1].offset, 4, (uint32_t *)&tdata->u_texSize);
GX2SetPixelUniformReg(wiiuTextureShader.pixelShader->uniformVars[0].offset, 4, (uint32_t*)&tdata->u_mod);
GX2RSetAttributeBuffer(a_position, 0, a_position->elemSize, 0);
GX2RSetAttributeBuffer(a_texCoord, 1, a_texCoord->elemSize, 0);
GX2SetPixelTexture(&tdata->texture, wiiuTextureShader.pixelShader->samplerVars[0].location);
GX2SetPixelSampler(&tdata->sampler, wiiuTextureShader.pixelShader->samplerVars[0].location);
GX2SetColorControl(GX2_LOGIC_OP_COPY, 0x00, FALSE, TRUE);
GX2DrawEx(GX2_PRIMITIVE_MODE_QUADS, 4, 0, 1);
}
void WIIU_SDL_RenderPresent(SDL_Renderer * renderer)
{
WIIU_RenderData *data = (WIIU_RenderData *) renderer->driverdata;
Uint32 flags = SDL_GetWindowFlags(renderer->window);
if (renderer->info.flags & SDL_RENDERER_PRESENTVSYNC) {
/* NOTE watch libwhb's source to ensure this call only does vsync */
WHBGfxBeginRender();
}
/* Only render to TV if the window is *not* drc-only */
if (!(flags & SDL_WINDOW_WIIU_GAMEPAD_ONLY)) {
WHBGfxBeginRenderTV();
render_scene(renderer);
GX2CopySurface(&tdata->texture.surface, 0, 0, &WHBGfxGetTVColourBuffer()->surface, 0, 0);
GX2SetContextState(data->ctx);
WHBGfxFinishRenderTV();
}
if (!(flags & SDL_WINDOW_WIIU_TV_ONLY)) {
WHBGfxBeginRenderDRC();
render_scene(renderer);
GX2CopySurface(&tdata->texture.surface, 0, 0, &WHBGfxGetDRCColourBuffer()->surface, 0, 0);
GX2SetContextState(data->ctx);
WHBGfxFinishRenderDRC();
}

View File

@ -0,0 +1,438 @@
/*
Simple DirectMedia Layer
Copyright (C) 2022 GaryOderNichts <garyodernichts@gmail.com>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "../../SDL_internal.h"
#if SDL_VIDEO_RENDER_WIIU
#include "../SDL_sysrender.h"
#include "SDL_hints.h"
#include "SDL_render_wiiu.h"
#include <gx2/texture.h>
#include <gx2/draw.h>
#include <gx2/registers.h>
#include <gx2/sampler.h>
#include <gx2/state.h>
#include <gx2/clear.h>
#include <gx2/mem.h>
#include <gx2/event.h>
#include <gx2r/surface.h>
#include <gx2r/buffer.h>
#include <gx2r/draw.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int WIIU_SDL_QueueSetViewport(SDL_Renderer * renderer, SDL_RenderCommand * cmd)
{
return 0;
}
int WIIU_SDL_QueueSetDrawColor(SDL_Renderer * renderer, SDL_RenderCommand * cmd)
{
return 0;
}
int WIIU_SDL_QueueDrawPoints(SDL_Renderer * renderer, SDL_RenderCommand * cmd, const SDL_FPoint * points, int count)
{
WIIU_RenderData *data = (WIIU_RenderData *) renderer->driverdata;
SDL_VertexSolid *vertices;
GX2RBuffer *vertexBuffer;
SDL_Color color;
color.r = cmd->data.draw.r;
color.g = cmd->data.draw.g;
color.b = cmd->data.draw.b;
color.a = cmd->data.draw.a;
vertexBuffer = WIIU_AllocRenderData(data, (GX2RBuffer) {
.flags =
GX2R_RESOURCE_BIND_VERTEX_BUFFER |
GX2R_RESOURCE_USAGE_CPU_WRITE,
.elemSize = sizeof(SDL_VertexSolid),
.elemCount = count,
});
if (!vertexBuffer) {
return -1;
}
cmd->data.draw.first = (size_t)vertexBuffer;
cmd->data.draw.count = count;
vertices = GX2RLockBufferEx(vertexBuffer, 0);
for (int i = 0; i < count; ++i) {
vertices[i].position.x = points[i].x;
vertices[i].position.y = points[i].y;
vertices[i].color = color;
}
GX2RUnlockBufferEx(vertexBuffer, 0);
return 0;
}
int WIIU_SDL_QueueDrawLines(SDL_Renderer * renderer, SDL_RenderCommand * cmd, const SDL_FPoint * points, int count)
{
WIIU_RenderData *data = (WIIU_RenderData *) renderer->driverdata;
SDL_VertexSolid *vertices;
GX2RBuffer *vertexBuffer;
SDL_Color color;
color.r = cmd->data.draw.r;
color.g = cmd->data.draw.g;
color.b = cmd->data.draw.b;
color.a = cmd->data.draw.a;
vertexBuffer = WIIU_AllocRenderData(data, (GX2RBuffer) {
.flags =
GX2R_RESOURCE_BIND_VERTEX_BUFFER |
GX2R_RESOURCE_USAGE_CPU_WRITE,
.elemSize = sizeof(SDL_VertexSolid),
.elemCount = (count - 1) * 2,
});
if (!vertexBuffer) {
return -1;
}
cmd->data.draw.first = (size_t)vertexBuffer;
cmd->data.draw.count = (count - 1) * 2;
vertices = GX2RLockBufferEx(vertexBuffer, 0);
for (int i = 0; i < count - 1; ++i) {
vertices[i * 2].position.x = points[i].x;
vertices[i * 2].position.y = points[i].y;
vertices[i * 2].color = color;
vertices[i * 2 + 1].position.x = points[i + 1].x;
vertices[i * 2 + 1].position.y = points[i + 1].y;
vertices[i * 2 + 1].color = color;
}
GX2RUnlockBufferEx(vertexBuffer, 0);
return 0;
}
int WIIU_SDL_QueueGeometry(SDL_Renderer * renderer, SDL_RenderCommand * cmd, SDL_Texture * texture,
const float * xy, int xy_stride, const SDL_Color * color, int color_stride, const float * uv, int uv_stride,
int num_vertices, const void * indices, int num_indices, int size_indices,
float scale_x, float scale_y)
{
WIIU_RenderData *data = (WIIU_RenderData *) renderer->driverdata;
GX2RBuffer *vertexBuffer;
int count = indices ? num_indices : num_vertices;
cmd->data.draw.count = count;
size_indices = indices ? size_indices : 0;
if (texture) {
SDL_Vertex *vertices;
vertexBuffer = WIIU_AllocRenderData(data, (GX2RBuffer) {
.flags =
GX2R_RESOURCE_BIND_VERTEX_BUFFER |
GX2R_RESOURCE_USAGE_CPU_WRITE,
.elemSize = sizeof(SDL_Vertex),
.elemCount = count,
});
if (!vertexBuffer) {
return -1;
}
vertices = GX2RLockBufferEx(vertexBuffer, 0);
for (int i = 0; i < count; i++) {
int j;
float *xy_;
float *uv_;
SDL_Color col_;
if (size_indices == 4) {
j = ((const Uint32 *)indices)[i];
} else if (size_indices == 2) {
j = ((const Uint16 *)indices)[i];
} else if (size_indices == 1) {
j = ((const Uint8 *)indices)[i];
} else {
j = i;
}
xy_ = (float *)((char*)xy + j * xy_stride);
col_ = *(SDL_Color *)((char*)color + j * color_stride);
uv_ = (float *)((char*)uv + j * uv_stride);
vertices[i].position.x = xy_[0] * scale_x;
vertices[i].position.y = xy_[1] * scale_y;
vertices[i].tex_coord.x = uv_[0];
vertices[i].tex_coord.y = uv_[1];
vertices[i].color = col_;
}
GX2RUnlockBufferEx(vertexBuffer, 0);
cmd->data.draw.first = (size_t)vertexBuffer;
} else {
SDL_VertexSolid *vertices;
vertexBuffer = WIIU_AllocRenderData(data, (GX2RBuffer) {
.flags =
GX2R_RESOURCE_BIND_VERTEX_BUFFER |
GX2R_RESOURCE_USAGE_CPU_WRITE,
.elemSize = sizeof(SDL_VertexSolid),
.elemCount = count,
});
if (!vertexBuffer) {
return -1;
}
vertices = GX2RLockBufferEx(vertexBuffer, 0);
for (int i = 0; i < count; i++) {
int j;
float *xy_;
SDL_Color col_;
if (size_indices == 4) {
j = ((const Uint32 *)indices)[i];
} else if (size_indices == 2) {
j = ((const Uint16 *)indices)[i];
} else if (size_indices == 1) {
j = ((const Uint8 *)indices)[i];
} else {
j = i;
}
xy_ = (float *)((char*)xy + j * xy_stride);
col_ = *(SDL_Color *)((char*)color + j * color_stride);
vertices[i].position.x = xy_[0] * scale_x;
vertices[i].position.y = xy_[1] * scale_y;
vertices[i].color = col_;
}
GX2RUnlockBufferEx(vertexBuffer, 0);
cmd->data.draw.first = (size_t)vertexBuffer;
}
return 0;
}
static int WIIU_SDL_RenderClear(SDL_Renderer * renderer, SDL_RenderCommand * cmd)
{
WIIU_RenderData *data = (WIIU_RenderData*) renderer->driverdata;
SDL_Texture *target = WIIU_GetRenderTarget(renderer);
WIIU_TextureData *tdata = (WIIU_TextureData*) target->driverdata;
GX2ClearColor(&tdata->cbuf,
(float) cmd->data.color.r / 255.0f,
(float) cmd->data.color.g / 255.0f,
(float) cmd->data.color.b / 255.0f,
(float) cmd->data.color.a / 255.0f);
/* Restore SDL context state */
GX2SetContextState(data->ctx);
return 0;
}
static int WIIU_SDL_SetDrawState(WIIU_RenderData * data, const SDL_RenderCommand * cmd)
{
SDL_bool matrixUpdated = SDL_FALSE;
SDL_bool shaderUpdated = SDL_FALSE;
const SDL_BlendMode blendMode = cmd->data.draw.blend;
WIIU_ShaderType shader = cmd->data.draw.texture ? SHADER_TEXTURE : SHADER_COLOR;
WHBGfxShaderGroup* shaderGroup = WIIU_SDL_GetShaderGroup(shader);
SDL_Texture *texture = cmd->data.draw.texture;
if (data->drawState.viewportDirty) {
const SDL_Rect *viewport = &data->drawState.viewport;
GX2SetViewport(viewport->x, viewport->y, viewport->w, viewport->h, 0.0f, 1.0f);
if (viewport->w && viewport->h) {
data->drawState.projectionMatrix[0][0] = 2.0f / viewport->w;
data->drawState.projectionMatrix[1][1] = 2.0f / viewport->h;
matrixUpdated = SDL_TRUE;
}
data->drawState.viewportDirty = SDL_FALSE;
}
if (data->drawState.cliprectEnabledDirty || data->drawState.cliprectDirty) {
SDL_Rect scissor;
const SDL_Rect *viewport = &data->drawState.viewport;
const SDL_Rect *rect = &data->drawState.cliprect;
if (data->drawState.cliprectEnabled) {
// make sure scissor is never larger than the colorbuffer to prevent memory corruption
scissor.x = SDL_min(viewport->w, rect->x);
scissor.y = SDL_min(viewport->h, rect->h);
scissor.w = SDL_min(viewport->w, rect->w);
scissor.h = SDL_min(viewport->w, rect->h);
} else {
scissor = *viewport;
}
GX2SetScissor(scissor.x, scissor.y, scissor.w, scissor.h);
data->drawState.cliprectEnabledDirty = SDL_FALSE;
data->drawState.cliprectDirty = SDL_FALSE;
}
if (blendMode != data->drawState.blendMode) {
if (blendMode == SDL_BLENDMODE_NONE) {
GX2SetColorControl(GX2_LOGIC_OP_COPY, 0x00, FALSE, TRUE);
} else {
GX2SetColorControl(GX2_LOGIC_OP_COPY, 0xFF, FALSE, TRUE);
GX2SetBlendControl(GX2_RENDER_TARGET_0,
WIIU_SDL_GetBlendMode(SDL_GetBlendModeSrcColorFactor(blendMode)),
WIIU_SDL_GetBlendMode(SDL_GetBlendModeDstColorFactor(blendMode)),
WIIU_SDL_GetBlendCombineMode(SDL_GetBlendModeColorOperation(blendMode)),
TRUE,
WIIU_SDL_GetBlendMode(SDL_GetBlendModeSrcAlphaFactor(blendMode)),
WIIU_SDL_GetBlendMode(SDL_GetBlendModeDstAlphaFactor(blendMode)),
WIIU_SDL_GetBlendCombineMode(SDL_GetBlendModeAlphaOperation(blendMode)));
}
data->drawState.blendMode = blendMode;
}
if (shader != data->drawState.shader) {
WIIU_SDL_SelectShader(shader);
shaderUpdated = SDL_TRUE;
data->drawState.shader = shader;
}
if (shaderUpdated || matrixUpdated) {
GX2SetVertexUniformReg(shaderGroup->vertexShader->uniformVars[0].offset, 16, data->drawState.projectionMatrix);
}
if (texture != data->drawState.texture) {
if (texture) {
WIIU_TextureData *tdata = (WIIU_TextureData*) texture->driverdata;
uint32_t location = shaderGroup->pixelShader->samplerVars[0].location;
GX2SetPixelTexture(&tdata->texture, location);
GX2SetPixelSampler(&tdata->sampler, location);
WIIU_TextureStartRendering(data, tdata);
}
data->drawState.texture = texture;
}
return 0;
}
int WIIU_SDL_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertices, size_t vertsize)
{
WIIU_RenderData* data = (WIIU_RenderData*) renderer->driverdata;
data->drawState.target = renderer->target;
if (!data->drawState.target) {
int w, h;
SDL_GL_GetDrawableSize(renderer->window, &w, &h);
if ((w != data->drawState.drawableWidth) || (h != data->drawState.drawableHeight)) {
data->drawState.viewportDirty = SDL_TRUE; // if the window dimensions changed, invalidate the current viewport, etc.
data->drawState.cliprectDirty = SDL_TRUE;
data->drawState.drawableWidth = w;
data->drawState.drawableHeight = h;
}
}
while (cmd) {
switch (cmd->command) {
case SDL_RENDERCMD_SETVIEWPORT: {
SDL_Rect *viewport = &data->drawState.viewport;
if (SDL_memcmp(viewport, &cmd->data.viewport.rect, sizeof (SDL_Rect)) != 0) {
SDL_memcpy(viewport, &cmd->data.viewport.rect, sizeof (SDL_Rect));
data->drawState.viewportDirty = SDL_TRUE;
}
break;
}
case SDL_RENDERCMD_SETCLIPRECT: {
const SDL_Rect *rect = &cmd->data.cliprect.rect;
if (data->drawState.cliprectEnabled != cmd->data.cliprect.enabled) {
data->drawState.cliprectEnabled = cmd->data.cliprect.enabled;
data->drawState.cliprectEnabledDirty = SDL_TRUE;
}
if (SDL_memcmp(&data->drawState.cliprect, rect, sizeof (SDL_Rect)) != 0) {
SDL_memcpy(&data->drawState.cliprect, rect, sizeof (SDL_Rect));
data->drawState.cliprectDirty = SDL_TRUE;
}
break;
}
case SDL_RENDERCMD_SETDRAWCOLOR:
break;
case SDL_RENDERCMD_CLEAR: {
WIIU_SDL_RenderClear(renderer, cmd);
break;
}
case SDL_RENDERCMD_DRAW_POINTS: {
GX2RBuffer *vertexBuffer = (GX2RBuffer *) cmd->data.draw.first;
WIIU_SDL_SetDrawState(data, cmd);
GX2RSetAttributeBuffer(vertexBuffer, 0, vertexBuffer->elemSize, 0);
GX2DrawEx(GX2_PRIMITIVE_MODE_POINTS, cmd->data.draw.count, 0, 1);
break;
}
case SDL_RENDERCMD_DRAW_LINES: {
GX2RBuffer *vertexBuffer = (GX2RBuffer *) cmd->data.draw.first;
WIIU_SDL_SetDrawState(data, cmd);
GX2RSetAttributeBuffer(vertexBuffer, 0, vertexBuffer->elemSize, 0);
GX2DrawEx(GX2_PRIMITIVE_MODE_LINE_STRIP, cmd->data.draw.count, 0, 1);
break;
}
/* unused (will be handled by geometry) */
case SDL_RENDERCMD_FILL_RECTS:
case SDL_RENDERCMD_COPY:
case SDL_RENDERCMD_COPY_EX:
break;
case SDL_RENDERCMD_GEOMETRY: {
GX2RBuffer *vertexBuffer = (GX2RBuffer *) cmd->data.draw.first;
WIIU_SDL_SetDrawState(data, cmd);
GX2RSetAttributeBuffer(vertexBuffer, 0, vertexBuffer->elemSize, 0);
GX2DrawEx(GX2_PRIMITIVE_MODE_TRIANGLES, cmd->data.draw.count, 0, 1);
}
case SDL_RENDERCMD_NO_OP:
break;
}
cmd = cmd->next;
}
return 0;
}
#endif /* SDL_VIDEO_RENDER_WIIU */

View File

@ -2,6 +2,7 @@
Simple DirectMedia Layer
Copyright (C) 2018-2019 Ash Logan <ash@heyquark.com>
Copyright (C) 2018-2019 Roberto Van Eeden <r.r.qwertyuiop.r.r@gmail.com>
Copyright (C) 2022 GaryOderNichts <garyodernichts@gmail.com>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@ -39,7 +40,7 @@
int WIIU_SDL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
{
BOOL res;
WIIUPixFmt gx2_fmt;
WIIU_PixFmt gx2_fmt;
GX2RResourceFlags surface_flags;
WIIU_TextureData *tdata = (WIIU_TextureData *) SDL_calloc(1, sizeof(*tdata));
if (!tdata) {
@ -53,8 +54,10 @@ int WIIU_SDL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
GX2InitSampler(&tdata->sampler, GX2_TEX_CLAMP_MODE_CLAMP, GX2_TEX_XY_FILTER_MODE_LINEAR);
}
gx2_fmt = SDLFormatToWIIUFormat(texture->format);
gx2_fmt = WIIU_SDL_GetPixFmt(texture->format);
if (gx2_fmt.fmt == -1) {
return SDL_SetError("Unsupported texture format");
}
/* Setup GX2Texture */
tdata->texture.surface.width = texture->w;
@ -107,20 +110,6 @@ int WIIU_SDL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
return SDL_OutOfMemory();
}
/* Initialize texture size uniform */
tdata->u_texSize = (WIIUVec4) {
.x = texture->w,
.y = texture->h,
};
/* Initialize color modifier uniform */
tdata->u_mod = (WIIUVec4) {
.r = (float)texture->r / 255.0f,
.g = (float)texture->g / 255.0f,
.b = (float)texture->b / 255.0f,
.a = (float)texture->a / 255.0f,
};
/* Setup texture driver data */
texture->driverdata = tdata;
@ -161,6 +150,17 @@ void WIIU_SDL_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
GX2RUnlockSurfaceEx(&tdata->texture.surface, 0, 0);
}
void WIIU_SDL_SetTextureScaleMode(SDL_Renderer * renderer, SDL_Texture * texture, SDL_ScaleMode scaleMode)
{
WIIU_TextureData *tdata = (WIIU_TextureData *) texture->driverdata;
if (texture->scaleMode == SDL_ScaleModeNearest) {
GX2InitSampler(&tdata->sampler, GX2_TEX_CLAMP_MODE_CLAMP, GX2_TEX_XY_FILTER_MODE_POINT);
} else {
GX2InitSampler(&tdata->sampler, GX2_TEX_CLAMP_MODE_CLAMP, GX2_TEX_XY_FILTER_MODE_LINEAR);
}
}
int WIIU_SDL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * rect, const void *pixels, int pitch)
{
@ -183,28 +183,6 @@ int WIIU_SDL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
return 0;
}
int WIIU_SDL_SetTextureColorMod(SDL_Renderer * renderer, SDL_Texture * texture)
{
WIIU_TextureData *tdata = (WIIU_TextureData *) texture->driverdata;
/* Compute color mod */
tdata->u_mod.r = (float)texture->r / 255.0f;
tdata->u_mod.g = (float)texture->g / 255.0f;
tdata->u_mod.b = (float)texture->b / 255.0f;
return 0;
}
int WIIU_SDL_SetTextureAlphaMod(SDL_Renderer * renderer, SDL_Texture * texture)
{
WIIU_TextureData *tdata = (WIIU_TextureData *) texture->driverdata;
/* Compute alpha mod */
tdata->u_mod.a = (float)texture->a / 255.0f;
return 0;
}
void WIIU_SDL_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture)
{
WIIU_RenderData *data;

View File

@ -29,35 +29,10 @@
void WIIU_SDL_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event)
{
if (event->event == SDL_WINDOWEVENT_SIZE_CHANGED) {
/* Re-init the colour buffer etc. for new window size
TODO check: what if we're rendering to a texture when this happens?
SDL may handle this already, see SDL_render.c: SDL_RendererEventWatch */
/* Re-init the colour buffer etc. for new window size */
WIIU_SDL_CreateWindowTex(renderer, renderer->window);
WIIU_SDL_SetRenderTarget(renderer, NULL);
}
}
/* We always output at whatever res the window is.
This may need to change if SDL_wiiuvideo is ever folded into SDL_render -
see SDL_*WindowTexture from SDL_video.c for how this could be done */
int WIIU_SDL_GetOutputSize(SDL_Renderer * renderer, int *w, int *h)
{
SDL_GetWindowSize(renderer->window, w, h);
return 0;
}
/* We handle all viewport changes in the render functions and shaders, so we
don't actually have to do anything here. SDL still requires we implement it. */
int WIIU_SDL_UpdateViewport(SDL_Renderer * renderer)
{
return 0;
}
/* Ideally this should change the GX2SetScissor values, but SetRenderTarget
needs refactoring first or these get overwritten. */
int WIIU_SDL_UpdateClipRect(SDL_Renderer * renderer)
{
return 0;
}
#endif //SDL_VIDEO_RENDER_WIIU

View File

@ -0,0 +1,74 @@
/*
Simple DirectMedia Layer
Copyright (C) 2022 GaryOderNichts <garyodernichts@gmail.com>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "../../SDL_internal.h"
#if SDL_VIDEO_RENDER_WIIU
#include "SDL_shaders_wiiu.h"
#include "shaders/colorShader.inc"
#include "shaders/textureShader.inc"
static WHBGfxShaderGroup shaderGroups[NUM_SHADERS];
static int shaderRefCount = 0;
void WIIU_SDL_CreateShaders(void)
{
if (!shaderRefCount++) {
WHBGfxShaderGroup* colorShader = &shaderGroups[SHADER_COLOR];
WHBGfxShaderGroup* textureShader = &shaderGroups[SHADER_TEXTURE];
WHBGfxLoadGFDShaderGroup(colorShader, 0, colorShader_gsh);
WHBGfxInitShaderAttribute(colorShader, "a_position", 0, 0, GX2_ATTRIB_FORMAT_FLOAT_32_32);
WHBGfxInitShaderAttribute(colorShader, "a_color", 0, 8, GX2_ATTRIB_FORMAT_FLOAT_32_32_32_32);
WHBGfxInitFetchShader(colorShader);
WHBGfxLoadGFDShaderGroup(textureShader, 0, textureShader_gsh);
WHBGfxInitShaderAttribute(textureShader, "a_position", 0, 0, GX2_ATTRIB_FORMAT_FLOAT_32_32);
WHBGfxInitShaderAttribute(textureShader, "a_color", 0, 8, GX2_ATTRIB_FORMAT_UNORM_8_8_8_8);
WHBGfxInitShaderAttribute(textureShader, "a_texcoord", 0, 12, GX2_ATTRIB_FORMAT_FLOAT_32_32);
WHBGfxInitFetchShader(textureShader);
}
}
void WIIU_SDL_DestroyShaders(void)
{
if (!--shaderRefCount) {
WHBGfxFreeShaderGroup(&shaderGroups[SHADER_COLOR]);
WHBGfxFreeShaderGroup(&shaderGroups[SHADER_TEXTURE]);
}
}
void WIIU_SDL_SelectShader(WIIU_ShaderType shader)
{
WHBGfxShaderGroup* shaderGroup = &shaderGroups[shader];
GX2SetFetchShader(&shaderGroup->fetchShader);
GX2SetVertexShader(shaderGroup->vertexShader);
GX2SetPixelShader(shaderGroup->pixelShader);
}
WHBGfxShaderGroup* WIIU_SDL_GetShaderGroup(WIIU_ShaderType shader)
{
return &shaderGroups[shader];
}
#endif //SDL_VIDEO_RENDER_WIIU

View File

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 2022 GaryOderNichts <garyodernichts@gmail.com>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@ -18,21 +18,27 @@
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "../../SDL_internal.h"
#include "../SDL_thread_c.h"
#ifndef SDL_shaders_wiiu_h
#define SDL_shaders_wiiu_h
SDL_TLSData *
SDL_SYS_GetTLSData(void)
{
return SDL_Generic_GetTLSData();
}
#if SDL_VIDEO_RENDER_WIIU
int
SDL_SYS_SetTLSData(SDL_TLSData *data)
{
return SDL_Generic_SetTLSData(data);
}
#include <whb/gfx.h>
/* vi: set ts=4 sw=4 expandtab: */
typedef enum {
SHADER_INVALID = -1,
SHADER_COLOR,
SHADER_TEXTURE,
NUM_SHADERS
} WIIU_ShaderType;
void WIIU_SDL_CreateShaders(void);
void WIIU_SDL_DestroyShaders(void);
void WIIU_SDL_SelectShader(WIIU_ShaderType shader);
WHBGfxShaderGroup* WIIU_SDL_GetShaderGroup(WIIU_ShaderType shader);
#endif /* SDL_VIDEO_RENDER_WIIU */
#endif /* SDL_shaders_wiiu_h */

2
src/render/wiiu/shaders/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
latte-assembler
*.gsh

View File

@ -0,0 +1,17 @@
#!/bin/bash
# to build shaders you need to place a copy of latte-assembler into the current directory
# latte-assembler is part of decaf-emu <https://github.com/decaf-emu/decaf-emu>
cd "${0%/*}"
# colorShader
echo "Building colorShader ..."
./latte-assembler assemble --vsh=colorShader.vsh --psh=colorShader.psh colorShader.gsh
xxd -i colorShader.gsh > colorShader.inc
echo "Done!"
# textureShader
echo "Building textureShader ..."
./latte-assembler assemble --vsh=textureShader.vsh --psh=textureShader.psh textureShader.gsh
xxd -i textureShader.gsh > textureShader.inc
echo "Done!"

View File

@ -0,0 +1,111 @@
unsigned char colorShader_gsh[] = {
0x47, 0x66, 0x78, 0x32, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x07,
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x4c, 0x4b, 0x7b,
0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0xc8, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0xff, 0xff, 0x00,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x02,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xff,
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x01, 0x70,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xd0, 0x60, 0x01, 0x34,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x02, 0xd0, 0x60, 0x01, 0x48, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xca, 0x70, 0x01, 0x68, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xca, 0x70, 0x01, 0x78,
0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xca, 0x70, 0x01, 0x84, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01, 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63,
0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x61, 0x5f, 0x70, 0x6f,
0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x61, 0x5f, 0x63, 0x6f,
0x6c, 0x6f, 0x72, 0x00, 0xd0, 0x60, 0x00, 0xe8, 0xd0, 0x60, 0x01, 0x08,
0xca, 0x70, 0x01, 0x34, 0xca, 0x70, 0x01, 0x48, 0xca, 0x70, 0x01, 0x58,
0x7d, 0x42, 0x4c, 0x4b, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x8c, 0xd0, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24,
0xd0, 0x60, 0x01, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05,
0xd0, 0x60, 0x01, 0x8c, 0x42, 0x4c, 0x4b, 0x7b, 0x00, 0x00, 0x00, 0x20,
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05,
0x00, 0x00, 0x01, 0x70, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x09, 0x20, 0x00, 0x00, 0x00,
0x00, 0x00, 0x34, 0xa0, 0x3c, 0xa0, 0x00, 0x00, 0x88, 0x06, 0x00, 0x94,
0x00, 0x40, 0x01, 0x00, 0x88, 0x06, 0x20, 0x14, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xfd, 0x60, 0x20, 0x00, 0x80, 0x00, 0x00, 0x00,
0xfd, 0x64, 0xa0, 0x00, 0x80, 0x00, 0x00, 0x20, 0xfd, 0x68, 0x20, 0x01,
0x80, 0x00, 0x00, 0x40, 0xfd, 0x6c, 0xa0, 0x81, 0x80, 0x00, 0x00, 0x60,
0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x80, 0x3f,
0x00, 0x00, 0x80, 0x3f, 0x01, 0x24, 0x20, 0x00, 0xfe, 0x00, 0xe2, 0x0f,
0x01, 0x24, 0xa0, 0x00, 0xfe, 0x04, 0xe2, 0x2f, 0x01, 0x24, 0x20, 0x01,
0xfe, 0x08, 0xe2, 0x4f, 0x01, 0x24, 0xa0, 0x81, 0xfe, 0x0c, 0xe2, 0x6f,
0x01, 0x00, 0x20, 0x00, 0xfe, 0x00, 0x22, 0x00, 0x01, 0x00, 0xa0, 0x00,
0xfe, 0x04, 0x22, 0x20, 0x01, 0x00, 0x20, 0x01, 0xfe, 0x08, 0x22, 0x40,
0x01, 0x00, 0xa0, 0x81, 0xfe, 0x0c, 0x22, 0x60, 0x42, 0x4c, 0x4b, 0x7b,
0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x01, 0x10, 0x00, 0x00, 0x00, 0x02,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02,
0x14, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f,
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7d, 0x42, 0x4c, 0x4b,
0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe8,
0xd0, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x60, 0x00, 0xe8,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x60, 0x00, 0xe8,
0x42, 0x4c, 0x4b, 0x7b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x08,
0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x88, 0x06, 0x20, 0x94, 0x42, 0x4c, 0x4b, 0x7b, 0x00, 0x00, 0x00, 0x20,
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00
};
unsigned int colorShader_gsh_len = 1296;

View File

@ -0,0 +1,9 @@
; $MODE = "UniformRegister"
; $NUM_SPI_PS_INPUT_CNTL = 1
; v_color R0
; $SPI_PS_INPUT_CNTL[0].SEMANTIC = 0
; $SPI_PS_INPUT_CNTL[0].DEFAULT_VAL = 1
00 EXP_DONE: PIX0, R0
END_OF_PROGRAM

View File

@ -0,0 +1,40 @@
; $MODE = "UniformRegister"
; $SPI_VS_OUT_CONFIG.VS_EXPORT_COUNT = 0
; $NUM_SPI_VS_OUT_ID = 1
; vColor
; $SPI_VS_OUT_ID[0].SEMANTIC_0 = 0
; C0
; $UNIFORM_VARS[0].name = "u_projection"
; $UNIFORM_VARS[0].type = "mat4"
; $UNIFORM_VARS[0].count = 1
; $UNIFORM_VARS[0].block = -1
; $UNIFORM_VARS[0].offset = 0
; R1
; $ATTRIB_VARS[0].name = "a_position"
; $ATTRIB_VARS[0].type = "vec2"
; $ATTRIB_VARS[0].location = 0
; R2
; $ATTRIB_VARS[1].name = "a_color"
; $ATTRIB_VARS[1].type = "vec4"
; $ATTRIB_VARS[1].location = 1
00 CALL_FS NO_BARRIER
01 ALU: ADDR(32) CNT(14)
0 x: MUL ____, 1.0f, C3.x
y: MUL ____, 1.0f, C3.y
z: MUL ____, 1.0f, C3.z
w: MUL ____, 1.0f, C3.w
1 x: MULADD R127.x, R1.y, C1.x, PV0.x
y: MULADD R127.y, R1.y, C1.y, PV0.y
z: MULADD R127.z, R1.y, C1.z, PV0.z
w: MULADD R127.w, R1.y, C1.w, PV0.w
2 x: MULADD R1.x, R1.x, C0.x, PV0.x
y: MULADD R1.y, R1.x, C0.y, PV0.y
z: MULADD R1.z, R1.x, C0.z, PV0.z
w: MULADD R1.w, R1.x, C0.w, PV0.w
02 EXP_DONE: POS0, R1
03 EXP_DONE: PARAM0, R2 NO_BARRIER
END_OF_PROGRAM

View File

@ -0,0 +1,149 @@
unsigned char textureShader_gsh[] = {
0x47, 0x66, 0x78, 0x32, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x07,
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x4c, 0x4b, 0x7b,
0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0xe8, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x04, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0xff, 0xff, 0x01, 0x00,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x03,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02,
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x01, 0x70,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xd0, 0x60, 0x01, 0x34,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x03, 0xd0, 0x60, 0x01, 0x48, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xca, 0x70, 0x01, 0x78, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xca, 0x70, 0x01, 0x88,
0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xca, 0x70, 0x01, 0x94, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01, 0xca, 0x70, 0x01, 0x9c, 0x00, 0x00, 0x00, 0x09,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x75, 0x5f, 0x70, 0x72,
0x6f, 0x6a, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x00,
0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00,
0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x61, 0x5f, 0x74, 0x65,
0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x00, 0x00, 0xd0, 0x60, 0x00, 0xe8,
0xd0, 0x60, 0x01, 0x08, 0xca, 0x70, 0x01, 0x34, 0xca, 0x70, 0x01, 0x48,
0xca, 0x70, 0x01, 0x58, 0xca, 0x70, 0x01, 0x68, 0x7d, 0x42, 0x4c, 0x4b,
0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xa8,
0xd0, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0xd0, 0x60, 0x01, 0x78,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xd0, 0x60, 0x01, 0xa8,
0x42, 0x4c, 0x4b, 0x7b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x01, 0x70,
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x80, 0x09, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0xa0,
0x3c, 0xa0, 0x00, 0x00, 0x88, 0x06, 0x00, 0x94, 0x00, 0x40, 0x01, 0x00,
0x88, 0x06, 0x80, 0x13, 0x01, 0xc0, 0x01, 0x00, 0x08, 0x09, 0x20, 0x14,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xfd, 0x60, 0x20, 0x00, 0x80, 0x00, 0x00, 0x00, 0xfd, 0x64, 0xa0, 0x00,
0x80, 0x00, 0x00, 0x20, 0xfd, 0x68, 0x20, 0x01, 0x80, 0x00, 0x00, 0x40,
0xfd, 0x6c, 0xa0, 0x81, 0x80, 0x00, 0x00, 0x60, 0x00, 0x00, 0x80, 0x3f,
0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x80, 0x3f,
0x01, 0x24, 0x20, 0x00, 0xfe, 0x00, 0xe2, 0x0f, 0x01, 0x24, 0xa0, 0x00,
0xfe, 0x04, 0xe2, 0x2f, 0x01, 0x24, 0x20, 0x01, 0xfe, 0x08, 0xe2, 0x4f,
0x01, 0x24, 0xa0, 0x81, 0xfe, 0x0c, 0xe2, 0x6f, 0x01, 0x00, 0x20, 0x00,
0xfe, 0x00, 0x22, 0x00, 0x01, 0x00, 0xa0, 0x00, 0xfe, 0x04, 0x22, 0x20,
0x01, 0x00, 0x20, 0x01, 0xfe, 0x08, 0x22, 0x40, 0x01, 0x00, 0xa0, 0x81,
0xfe, 0x0c, 0x22, 0x60, 0x42, 0x4c, 0x4b, 0x7b, 0x00, 0x00, 0x00, 0x20,
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06,
0x00, 0x00, 0x01, 0x30, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x14, 0x00, 0x00, 0x02,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x00,
0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x90,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xd0, 0x60, 0x00, 0xe8,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xca, 0x70, 0x00, 0xf4, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72,
0x65, 0x00, 0x00, 0x00, 0xd0, 0x60, 0x00, 0xd4, 0xca, 0x70, 0x00, 0xe8,
0x7d, 0x42, 0x4c, 0x4b, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00, 0xd0, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c,
0xd0, 0x60, 0x00, 0xf4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
0xd0, 0x60, 0x01, 0x00, 0x42, 0x4c, 0x4b, 0x7b, 0x00, 0x00, 0x00, 0x20,
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07,
0x00, 0x00, 0x01, 0x90, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00,
0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x80, 0x20, 0x00, 0x00, 0x00,
0x00, 0x00, 0x0c, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x88, 0x06, 0x20, 0x94,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00,
0x00, 0x24, 0x80, 0x00, 0x90, 0x00, 0x00, 0x20, 0x00, 0x28, 0x00, 0x01,
0x90, 0x00, 0x00, 0x40, 0x00, 0x2c, 0x80, 0x81, 0x90, 0x00, 0x00, 0x60,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x10, 0x00, 0x01, 0x00, 0x01, 0x10, 0x0d, 0xf0, 0x00, 0x00, 0x80, 0x10,
0x00, 0x00, 0x00, 0x00, 0x42, 0x4c, 0x4b, 0x7b, 0x00, 0x00, 0x00, 0x20,
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00
};
unsigned int textureShader_gsh_len = 1752;

View File

@ -0,0 +1,23 @@
; $MODE = "UniformRegister"
; $NUM_SPI_PS_INPUT_CNTL = 2
; v_color R0
; $SPI_PS_INPUT_CNTL[0].SEMANTIC = 0
; $SPI_PS_INPUT_CNTL[0].DEFAULT_VAL = 1
; v_texCoord R1
; $SPI_PS_INPUT_CNTL[1].SEMANTIC = 1
; $SPI_PS_INPUT_CNTL[1].DEFAULT_VAL = 1
; $SAMPLER_VARS[0].name = "u_texture"
; $SAMPLER_VARS[0].type = "SAMPLER2D"
; $SAMPLER_VARS[0].location = 0
00 TEX: ADDR(48) CNT(1) VALID_PIX
0 SAMPLE R1, R1.xy0x, t0, s0
01 ALU: ADDR(32) CNT(4)
1 x: MUL R0.x, R0.x, R1.x
y: MUL R0.y, R0.y, R1.y
z: MUL R0.z, R0.z, R1.z
w: MUL R0.w, R0.w, R1.w
02 EXP_DONE: PIX0, R0
END_OF_PROGRAM

View File

@ -0,0 +1,47 @@
; $MODE = "UniformRegister"
; $SPI_VS_OUT_CONFIG.VS_EXPORT_COUNT = 1
; $NUM_SPI_VS_OUT_ID = 1
; v_color
; $SPI_VS_OUT_ID[0].SEMANTIC_0 = 0
; v_texCoord
; $SPI_VS_OUT_ID[0].SEMANTIC_1 = 1
; C0
; $UNIFORM_VARS[0].name = "u_projection"
; $UNIFORM_VARS[0].type = "mat4"
; $UNIFORM_VARS[0].count = 1
; $UNIFORM_VARS[0].block = -1
; $UNIFORM_VARS[0].offset = 0
; R1
; $ATTRIB_VARS[0].name = "a_position"
; $ATTRIB_VARS[0].type = "vec2"
; $ATTRIB_VARS[0].location = 0
; R2
; $ATTRIB_VARS[1].name = "a_color"
; $ATTRIB_VARS[1].type = "vec4"
; $ATTRIB_VARS[1].location = 1
; R3
; $ATTRIB_VARS[2].name = "a_texcoord"
; $ATTRIB_VARS[2].type = "vec2"
; $ATTRIB_VARS[2].location = 2
00 CALL_FS NO_BARRIER
01 ALU: ADDR(32) CNT(14)
0 x: MUL ____, 1.0f, C3.x
y: MUL ____, 1.0f, C3.y
z: MUL ____, 1.0f, C3.z
w: MUL ____, 1.0f, C3.w
1 x: MULADD R127.x, R1.y, C1.x, PV0.x
y: MULADD R127.y, R1.y, C1.y, PV0.y
z: MULADD R127.z, R1.y, C1.z, PV0.z
w: MULADD R127.w, R1.y, C1.w, PV0.w
2 x: MULADD R1.x, R1.x, C0.x, PV0.x
y: MULADD R1.y, R1.x, C0.y, PV0.y
z: MULADD R1.z, R1.x, C0.z, PV0.z
w: MULADD R1.w, R1.x, C0.w, PV0.w
02 EXP_DONE: POS0, R1
03 EXP: PARAM0, R2 NO_BARRIER
04 EXP_DONE: PARAM1, R3.xy00 NO_BARRIER
END_OF_PROGRAM

View File

@ -46,7 +46,7 @@ thread_cleanup(OSThread *thread, void *stack)
{
}
int SDL_SYS_CreateThread(SDL_Thread *thread, void *args)
int SDL_SYS_CreateThread(SDL_Thread *thread)
{
OSThread *handle = (OSThread *)memalign(16, sizeof(OSThread));
unsigned int stackSize = thread->stacksize ? thread->stacksize : 0x8000;
@ -55,7 +55,7 @@ int SDL_SYS_CreateThread(SDL_Thread *thread, void *args)
if (!OSCreateThread(handle,
(OSThreadEntryPointFn)SDL_RunThread,
(int32_t)args,
(int32_t)thread,
NULL,
stackTop,
stackSize,

View File

@ -49,8 +49,8 @@ SDL_TicksQuit(void)
ticks_started = SDL_FALSE;
}
Uint32
SDL_GetTicks(void)
Uint64
SDL_GetTicks64(void)
{
OSTime now;
@ -59,7 +59,7 @@ SDL_GetTicks(void)
}
now = OSGetSystemTime();
return (Uint32)OSTicksToMilliseconds(now - start);
return (Uint64)OSTicksToMilliseconds(now - start);
}
Uint64

View File

@ -1514,7 +1514,7 @@ static int SDL_UpdateFullscreenMode(SDL_Window *window, SDL_bool fullscreen)
}
#define CREATE_FLAGS \
(SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI | SDL_WINDOW_ALWAYS_ON_TOP | SDL_WINDOW_SKIP_TASKBAR | SDL_WINDOW_POPUP_MENU | SDL_WINDOW_UTILITY | SDL_WINDOW_TOOLTIP | SDL_WINDOW_VULKAN | SDL_WINDOW_MINIMIZED | SDL_WINDOW_METAL)
(SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI | SDL_WINDOW_ALWAYS_ON_TOP | SDL_WINDOW_SKIP_TASKBAR | SDL_WINDOW_POPUP_MENU | SDL_WINDOW_UTILITY | SDL_WINDOW_TOOLTIP | SDL_WINDOW_VULKAN | SDL_WINDOW_MINIMIZED | SDL_WINDOW_METAL | SDL_WINDOW_WIIU_GAMEPAD_ONLY | SDL_WINDOW_WIIU_TV_ONLY)
static SDL_INLINE SDL_bool IsAcceptingDragAndDrop(void)
{

View File

@ -48,8 +48,6 @@
#include <proc_ui/procui.h>
#include "wiiu_shaders.h"
static int WIIU_VideoInit(_THIS);
static int WIIU_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode);
static void WIIU_VideoQuit(_THIS);
@ -70,9 +68,6 @@ static int WIIU_VideoInit(_THIS)
}
WHBGfxInit();
// setup shader
wiiuInitTextureShader();
// add default mode (1280x720)
mode.format = SDL_PIXELFORMAT_RGBA8888;
mode.w = SCREEN_WIDTH;
@ -89,13 +84,14 @@ static int WIIU_VideoInit(_THIS)
static void WIIU_VideoQuit(_THIS)
{
wiiuFreeTextureShader();
WHBGfxShutdown();
if (using_whb_proc) WHBProcShutdown();
}
static int WIIU_CreateSDLWindow(_THIS, SDL_Window *window) {
SDL_SetKeyboardFocus(window);
static int WIIU_CreateSDLWindow(_THIS, SDL_Window *window)
{
SDL_SetMouseFocus(window);
SDL_SetKeyboardFocus(window);
return 0;
}
@ -108,11 +104,6 @@ static void WIIU_PumpEvents(_THIS)
{
}
static int WIIU_Available(void)
{
return 1;
}
static void WIIU_DeleteDevice(SDL_VideoDevice *device)
{
SDL_free(device);
@ -141,7 +132,7 @@ static SDL_VideoDevice *WIIU_CreateDevice(int devindex)
VideoBootStrap WIIU_bootstrap = {
"WiiU", "Video driver for Nintendo WiiU",
WIIU_Available, WIIU_CreateDevice
WIIU_CreateDevice
};
#endif /* SDL_VIDEO_DRIVER_WIIU */

View File

@ -25,21 +25,10 @@
#ifndef SDL_wiiuvideo_h
#define SDL_wiiuvideo_h
#include <gx2/texture.h>
#include "SDL_surface.h"
#if SDL_VIDEO_DRIVER_WIIU
#define WIIU_WINDOW_DATA "_SDL_WiiUData"
typedef struct
{
SDL_Surface *surface;
GX2Texture texture;
} WIIU_WindowData;
typedef struct
{
SDL_bool tv_window_exists;
SDL_bool drc_window_exists;
SDL_bool mirrored_window_exists;
} WIIU_VideoDeviceData;
#endif //SDL_wiiuvideo_h
#endif /* SDL_VIDEO_DRIVER_WIIU */
#endif /* SDL_wiiuvideo_h */

View File

@ -1,14 +0,0 @@
#!/bin/bash
cd "${0%/*}"
echo "Regenerating wiiu_shaders.c ..."
latte-assembler compile colorShader.gsh --vsh colorShader.vsh --psh colorShader.psh
latte-assembler compile textureShader.gsh --vsh textureShader.vsh --psh textureShader.psh
xxd -i colorShader.gsh > colorShader.gsh.h
xxd -i textureShader.gsh > textureShader.gsh.h
sed -i '/_gsh_len/d' colorShader.gsh.h textureShader.gsh.h
sed -i 's/colorShader_gsh/wiiuColorShaderData/g' colorShader.gsh.h
sed -i 's/textureShader_gsh/wiiuTextureShaderData/g' textureShader.gsh.h
cp wiiu_shaders.c.in ../wiiu_shaders.c
cat colorShader.gsh.h textureShader.gsh.h >> ../wiiu_shaders.c
rm -rf colorShader.gsh textureShader.gsh colorShader.gsh.h textureShader.gsh.h
echo "Done!"

View File

@ -1,10 +0,0 @@
/* colorShader: fragment (pixel) shader (GLSL) */
/* compile with ShaderAnalyzer (rv770) + fix latte-assembler messages */
layout(location = 0) uniform vec4 u_color; /* color */
void main()
{
/* Set fragment color */
gl_FragColor = u_color;
}

View File

@ -1,14 +0,0 @@
; $MODE = "UniformRegister"
; $UNIFORM_VARS[0].name = "u_color"
; $UNIFORM_VARS[0].type = "float4"
; $UNIFORM_VARS[0].count = 1
; $UNIFORM_VARS[0].offset = 0
; $UNIFORM_VARS[0].block = -1
00 ALU: ADDR(32) CNT(4)
0 x: MOV R0.x, C0.x
y: MOV R0.y, C0.y
z: MOV R0.z, C0.z
w: MOV R0.w, C0.w
01 EXP_DONE: PIX0, R0
END_OF_PROGRAM

View File

@ -1,16 +0,0 @@
/* colorShader: vertex shader (GLSL) */
/* compile with ShaderAnalyzer (rv770) + fix latte-assembler messages */
layout(location = 0) uniform vec2 u_viewSize; /* viewport size */
layout(location = 0) in vec2 a_position; /* vertex position */
void main()
{
/* Compute relative vertex position */
a_position.y = u_viewSize.y - a_position.y;
a_position.x = ((a_position.x / u_viewSize.x) * 2.0f) - 1.0f;
a_position.y = ((a_position.y / u_viewSize.y) * 2.0f) - 1.0f;
/* Set vertex position */
gl_Position = vec4(a_position, 0.0, 1.0);
}

View File

@ -1,27 +0,0 @@
; $MODE = "UniformRegister"
; $UNIFORM_VARS[0].name = "u_viewSize"
; $UNIFORM_VARS[0].type = "float2"
; $UNIFORM_VARS[0].count = 1
; $UNIFORM_VARS[0].offset = 0
; $UNIFORM_VARS[0].block = -1
; $ATTRIB_VARS[0].name = "a_position"
; $ATTRIB_VARS[0].type = "float2"
; $ATTRIB_VARS[0].location = 0
00 CALL_FS NO_BARRIER
01 ALU: ADDR(32) CNT(9)
0 x: ADD R0.x, -R1.y, C0.y
z: MOV R2.z, 0.0f
w: MOV R2.w, (0x3F800000, 1.0f).x
t: RCP_e ____, C0.x
1 z: MUL_e*2 ____, R1.x, PS0
t: RCP_e ____, C0.y
2 x: MUL_e*2 ____, R0.x, PS1
t: ADD R2.x, PV1.z, -1.0f
3 y: ADD R2.y, PV2.x, -1.0f
02 EXP_DONE: POS0, R2
03 EXP_DONE: PARAM0, R0.____
04 ALU: ADDR(41) CNT(1)
4 x: NOP ____
05 NOP NO_BARRIER
END_OF_PROGRAM

View File

@ -1,13 +0,0 @@
/* textureShader: fragment (pixel) shader (GLSL) */
/* compile with ShaderAnalyzer (rv770) + fix latte-assembler messages */
/* NOTE: Ash knows R600 but not GLSL, so the .psh may have changes not in this
file. */
layout(location = 0) uniform sampler2D s_texture; /* texture sampler */
in vec2 texCoord; /* relative texture postion passed from vertex shader */
void main()
{
/* Compute fragment color for texture/position */
gl_FragColor = texture2D(s_texture, texCoord);
}

View File

@ -1,22 +0,0 @@
; $MODE = "UniformRegister"
; $SAMPLER_VARS[0].name= "s_texture"
; $SAMPLER_VARS[0].type= "sampler2D"
; $SAMPLER_VARS[0].location = 0
; $NUM_SPI_PS_INPUT_CNTL = 1
; $SPI_PS_INPUT_CNTL[0].semantic = 0
; $SPI_PS_INPUT_CNTL[0].default_val = 1
; $UNIFORM_VARS[0].name = "u_mod"
; $UNIFORM_VARS[0].type = "float4"
; $UNIFORM_VARS[0].count = 1
; $UNIFORM_VARS[0].offset = 0
; $UNIFORM_VARS[0].block = -1
00 TEX: ADDR(48) CNT(1) VALID_PIX
0 SAMPLE R0, R0.xy0x, t0, s0
01 ALU: ADDR(32) CNT(4)
1 x: MUL R0.x, R0.x, C0.x
y: MUL R0.y, R0.y, C0.y
z: MUL R0.z, R0.z, C0.z
w: MUL R0.w, R0.w, C0.w
02 EXP_DONE: PIX0, R0
END_OF_PROGRAM

View File

@ -1,27 +0,0 @@
/* textureShader: vertex shader (GLSL) */
/* compile with ShaderAnalyzer (rv770) + fix latte-assembler messages */
layout(location = 0) uniform vec2 u_viewSize; /* viewport size */
layout(location = 1) uniform vec2 u_texSize; /* texture size */
layout(location = 0) in vec2 a_position; /* vertex position */
layout(location = 1) in vec2 a_texCoordIn; /* texture position */
out vec2 texCoord; /* relative texture postion passed to pixel shader */
void main()
{
/* Compute relative vertex position */
a_position.y = u_viewSize.y - a_position.y;
a_position.x = ((a_position.x / u_viewSize.x) * 2.0f) - 1.0f;
a_position.y = ((a_position.y / u_viewSize.y) * 2.0f) - 1.0f;
/* Set vertex position */
gl_Position = vec4(a_position, 0.0, 1.0);
/* Compute relative coordinate position */
a_texCoordIn.y = u_texSize.y - a_texCoordIn.y;
a_texCoordIn.x = a_texCoordIn.x / u_texSize.x;
a_texCoordIn.y = a_texCoordIn.y / u_texSize.y;
/* Pass texture coordinate to pixel shader */
texCoord = a_texCoordIn;
}

View File

@ -1,44 +0,0 @@
; $MODE = "UniformRegister"
; $UNIFORM_VARS[0].name = "u_viewSize"
; $UNIFORM_VARS[0].type = "float2"
; $UNIFORM_VARS[0].count = 1
; $UNIFORM_VARS[0].offset = 4
; $UNIFORM_VARS[0].block = -1
; $UNIFORM_VARS[1].name = "u_texSize"
; $UNIFORM_VARS[1].type = "float2"
; $UNIFORM_VARS[1].count = 1
; $UNIFORM_VARS[1].offset = 0
; $UNIFORM_VARS[1].block = -1
; $ATTRIB_VARS[0].name = "a_position"
; $ATTRIB_VARS[0].type = "float2"
; $ATTRIB_VARS[0].location = 0
; $ATTRIB_VARS[1].name = "a_texCoordIn"
; $ATTRIB_VARS[1].type = "float2"
; $ATTRIB_VARS[1].location = 1
; $NUM_SPI_VS_OUT_ID = 1
; $SPI_VS_OUT_ID[0].semantic_0 = 0
00 CALL_FS NO_BARRIER
01 ALU: ADDR(32) CNT(16)
0 x: ADD R127.x, -R2.y, C0.y
z: MOV R0.z, 0.0f
w: ADD R127.w, -R1.y, C1.y VEC_120
t: RCP_e ____, C1.x
1 y: MUL_e*2 ____, R1.x, PS0
w: MOV R0.w, (0x3F800000, 1.0f).x
t: RCP_e ____, C1.y
2 x: MUL_e*2 ____, R127.w, PS1
t: ADD R0.x, PV1.y, -1.0f
3 y: ADD R0.y, PV2.x, -1.0f
t: RCP_e ____, C0.x
4 x: MUL_e ____, R2.x, PS3
t: RCP_e ____, C0.y
5 x: MOV R2.x, PV4.x
z: MUL_e ____, R127.x, PS4
6 y: MOV R2.y, PV5.z
02 EXP_DONE: POS0, R0
03 EXP_DONE: PARAM0, R2.xyzz NO_BARRIER
04 ALU: ADDR(48) CNT(1)
7 x: NOP ____
05 NOP NO_BARRIER
END_OF_PROGRAM

View File

@ -1,8 +0,0 @@
#include <whb/gfx.h>
WHBGfxShaderGroup wiiuTextureShader;
int wiiuTextureShaderInit = 0;
WHBGfxShaderGroup wiiuColorShader;
int wiiuColorShaderInit = 0;

View File

@ -1,293 +0,0 @@
#include <whb/gfx.h>
WHBGfxShaderGroup wiiuTextureShader;
int wiiuTextureShaderInit = 0;
WHBGfxShaderGroup wiiuColorShader;
int wiiuColorShaderInit = 0;
unsigned char wiiuColorShaderData[] = {
0x47, 0x66, 0x78, 0x32, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x07,
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x4c, 0x4b, 0x7b,
0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0xa8, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x01, 0x50,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xd0, 0x60, 0x01, 0x34,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01, 0xd0, 0x60, 0x01, 0x48, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xca, 0x70, 0x01, 0x58, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xca, 0x70, 0x01, 0x64,
0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x53, 0x69, 0x7a, 0x65, 0x00, 0x00,
0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00,
0xd0, 0x60, 0x00, 0xe8, 0xd0, 0x60, 0x01, 0x08, 0xca, 0x70, 0x01, 0x34,
0xca, 0x70, 0x01, 0x48, 0x7d, 0x42, 0x4c, 0x4b, 0x00, 0x00, 0x00, 0x28,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x70, 0xd0, 0x60, 0x00, 0x00,
0x00, 0x00, 0x00, 0x18, 0xd0, 0x60, 0x01, 0x58, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x04, 0xd0, 0x60, 0x01, 0x70, 0x42, 0x4c, 0x4b, 0x7b,
0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x01, 0x50, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x09,
0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0xa0, 0x3c, 0x20, 0x01, 0x00,
0x88, 0x06, 0x00, 0x94, 0x00, 0x40, 0x00, 0x00, 0xff, 0x0f, 0x00, 0x94,
0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x14, 0xa0, 0x00,
0x10, 0x00, 0x00, 0x00, 0xf8, 0x08, 0x00, 0x00, 0x90, 0x0c, 0x40, 0x40,
0xf9, 0x00, 0x00, 0x00, 0x90, 0x0c, 0x40, 0x60, 0x00, 0x01, 0x00, 0x80,
0x00, 0x33, 0x00, 0x00, 0x01, 0xe0, 0x1f, 0x01, 0x20, 0x01, 0x00, 0x40,
0x00, 0x05, 0x00, 0x80, 0x00, 0x33, 0x00, 0x00, 0x00, 0xe0, 0x1f, 0x00,
0x20, 0x01, 0x00, 0x00, 0xfe, 0x28, 0x1f, 0x82, 0x10, 0x00, 0x40, 0x00,
0xfe, 0x20, 0x9f, 0x82, 0x10, 0x00, 0x40, 0x20, 0x00, 0x00, 0x00, 0x80,
0x00, 0x0d, 0x00, 0x00, 0x42, 0x4c, 0x4b, 0x7b, 0x00, 0x00, 0x00, 0x20,
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06,
0x00, 0x00, 0x01, 0x34, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x14, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x20,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xd0, 0x60, 0x00, 0xe8,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xca, 0x70, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x0b,
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x75, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0xd0, 0x60, 0x00, 0xbc,
0xca, 0x70, 0x00, 0xe8, 0x7d, 0x42, 0x4c, 0x4b, 0x00, 0x00, 0x00, 0x28,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x04, 0xd0, 0x60, 0x00, 0x00,
0x00, 0x00, 0x00, 0x08, 0xd0, 0x60, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x02, 0xd0, 0x60, 0x01, 0x04, 0x42, 0x4c, 0x4b, 0x7b,
0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x01, 0x20, 0x00, 0x00, 0x00, 0x03,
0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0xa0,
0x00, 0x00, 0x00, 0x00, 0x88, 0x06, 0x20, 0x94, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
0x90, 0x0c, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x90, 0x0c, 0x00, 0x20,
0x00, 0x09, 0x00, 0x00, 0x90, 0x0c, 0x00, 0x40, 0x00, 0x0d, 0x00, 0x80,
0x90, 0x0c, 0x00, 0x60, 0x42, 0x4c, 0x4b, 0x7b, 0x00, 0x00, 0x00, 0x20,
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00
};
unsigned char wiiuTextureShaderData[] = {
0x47, 0x66, 0x78, 0x32, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x07,
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x4c, 0x4b, 0x7b,
0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0xf0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0xff, 0xff, 0x00,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x02,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xff,
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff,
0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x01, 0x88,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xd0, 0x60, 0x01, 0x34,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x02, 0xd0, 0x60, 0x01, 0x5c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xca, 0x70, 0x01, 0x7c, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0xca, 0x70, 0x01, 0x88,
0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xca, 0x70, 0x01, 0x94, 0x00, 0x00, 0x00, 0x09,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xca, 0x70, 0x01, 0xa0,
0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x53, 0x69, 0x7a, 0x65, 0x00, 0x00,
0x75, 0x5f, 0x74, 0x65, 0x78, 0x53, 0x69, 0x7a, 0x65, 0x00, 0x00, 0x00,
0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x00,
0x61, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6f, 0x72, 0x64, 0x49, 0x6e,
0x00, 0x00, 0x00, 0x00, 0xd0, 0x60, 0x00, 0xe8, 0xd0, 0x60, 0x01, 0x08,
0xca, 0x70, 0x01, 0x34, 0xca, 0x70, 0x01, 0x48, 0xca, 0x70, 0x01, 0x5c,
0xca, 0x70, 0x01, 0x6c, 0x7d, 0x42, 0x4c, 0x4b, 0x00, 0x00, 0x00, 0x28,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xb0, 0xd0, 0x60, 0x00, 0x00,
0x00, 0x00, 0x00, 0x34, 0xd0, 0x60, 0x01, 0x7c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x06, 0xd0, 0x60, 0x01, 0xb0, 0x42, 0x4c, 0x4b, 0x7b,
0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x01, 0x88, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x09,
0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0xa0, 0x3c, 0x20, 0x00, 0x00,
0x88, 0x06, 0x00, 0x94, 0x00, 0x40, 0x01, 0x00, 0x88, 0x04, 0x00, 0x14,
0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x14, 0xa0, 0x00,
0x10, 0x00, 0xe0, 0x0f, 0xf8, 0x08, 0x00, 0x00, 0x90, 0x0c, 0x00, 0x40,
0x01, 0x34, 0xa0, 0x00, 0x10, 0x00, 0xe8, 0x6f, 0x01, 0x01, 0x00, 0x80,
0x00, 0x33, 0x00, 0x00, 0x01, 0xe0, 0x9f, 0x00, 0x20, 0x01, 0x00, 0x20,
0xf9, 0x00, 0x00, 0x00, 0x90, 0x0c, 0x00, 0x60, 0x01, 0x05, 0x00, 0x80,
0x00, 0x33, 0x00, 0x00, 0x7f, 0xec, 0x1f, 0x00, 0x20, 0x01, 0x00, 0x00,
0xfe, 0x24, 0x1f, 0x82, 0x10, 0x00, 0x00, 0x00, 0xfe, 0x20, 0x9f, 0x02,
0x10, 0x00, 0x00, 0x20, 0x00, 0x01, 0x00, 0x80, 0x00, 0x33, 0x00, 0x00,
0x02, 0xe0, 0x1f, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x05, 0x00, 0x80,
0x00, 0x33, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x90, 0x0c, 0x40, 0x00,
0x7f, 0xe0, 0x1f, 0x81, 0x00, 0x01, 0x00, 0x40, 0xfe, 0x08, 0x00, 0x80,
0x90, 0x0c, 0x40, 0x20, 0x00, 0x00, 0x00, 0x80, 0x00, 0x0d, 0x00, 0x00,
0x42, 0x4c, 0x4b, 0x7b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x01, 0x54,
0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x02, 0x14, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x90, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01, 0xd0, 0x60, 0x00, 0xe8, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01, 0xd0, 0x60, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xca, 0x70, 0x01, 0x08, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xca, 0x70, 0x01, 0x10,
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f,
0x64, 0x00, 0x00, 0x00, 0x73, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72,
0x65, 0x00, 0x00, 0x00, 0xd0, 0x60, 0x00, 0xbc, 0xd0, 0x60, 0x00, 0xd4,
0xca, 0x70, 0x00, 0xe8, 0xca, 0x70, 0x00, 0xfc, 0x7d, 0x42, 0x4c, 0x4b,
0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x1c,
0xd0, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0xd0, 0x60, 0x01, 0x08,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xd0, 0x60, 0x01, 0x1c,
0x42, 0x4c, 0x4b, 0x7b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x01, 0x90,
0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00,
0x00, 0x00, 0xc0, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0xa0,
0x00, 0x00, 0x00, 0x00, 0x88, 0x06, 0x20, 0x94, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x20, 0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0x04, 0xa0, 0x00,
0x90, 0x00, 0x00, 0x20, 0x00, 0x08, 0x20, 0x01, 0x90, 0x00, 0x00, 0x40,
0x00, 0x0c, 0xa0, 0x81, 0x90, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
0x00, 0x10, 0x0d, 0xf0, 0x00, 0x00, 0x80, 0x10, 0x00, 0x00, 0x00, 0x00,
0x42, 0x4c, 0x4b, 0x7b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00
};

View File

@ -1,83 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 2018-2018 Ash Logan <ash@heyquark.com>
Copyright (C) 2018-2018 Roberto Van Eeden <r.r.qwertyuiop.r.r@gmail.com>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "../../SDL_internal.h"
#ifndef _WIIU_shaders_h
#define _WIIU_shaders_h
#include <whb/gfx.h>
#include <gx2/shaders.h>
extern unsigned char wiiuTextureShaderData[];
extern unsigned char wiiuColorShaderData[];
extern WHBGfxShaderGroup wiiuTextureShader;
extern int wiiuTextureShaderInit;
static inline void wiiuInitTextureShader() {
if (!wiiuTextureShaderInit) {
WHBGfxLoadGFDShaderGroup(&wiiuTextureShader, 0, wiiuTextureShaderData);
WHBGfxInitShaderAttribute(&wiiuTextureShader, "a_position", 0, 0, GX2_ATTRIB_FORMAT_FLOAT_32_32);
WHBGfxInitShaderAttribute(&wiiuTextureShader, "a_texCoordIn", 1, 0, GX2_ATTRIB_FORMAT_FLOAT_32_32);
WHBGfxInitFetchShader(&wiiuTextureShader);
}
wiiuTextureShaderInit++;
}
static inline void wiiuFreeTextureShader() {
if (wiiuTextureShaderInit)
if (!--wiiuTextureShaderInit)
WHBGfxFreeShaderGroup(&wiiuTextureShader);
}
static inline void wiiuSetTextureShader() {
GX2SetFetchShader(&wiiuTextureShader.fetchShader);
GX2SetVertexShader(wiiuTextureShader.vertexShader);
GX2SetPixelShader(wiiuTextureShader.pixelShader);
}
extern WHBGfxShaderGroup wiiuColorShader;
extern int wiiuColorShaderInit;
static inline void wiiuInitColorShader() {
if (!wiiuColorShaderInit) {
WHBGfxLoadGFDShaderGroup(&wiiuColorShader, 0, wiiuColorShaderData);
WHBGfxInitShaderAttribute(&wiiuColorShader, "a_position", 0, 0, GX2_ATTRIB_FORMAT_FLOAT_32_32);
WHBGfxInitFetchShader(&wiiuColorShader);
}
wiiuColorShaderInit++;
}
static inline void wiiuFreeColorShader() {
if (wiiuColorShaderInit)
if (!--wiiuColorShaderInit)
WHBGfxFreeShaderGroup(&wiiuColorShader);
}
static inline void wiiuSetColorShader() {
GX2SetFetchShader(&wiiuColorShader.fetchShader);
GX2SetVertexShader(wiiuColorShader.vertexShader);
GX2SetPixelShader(wiiuColorShader.pixelShader);
}
#endif //_WIIU_shaders_h