Skip to content

Commit

Permalink
Merge branch 'SDL2' into MorphOS-SDL-2
Browse files Browse the repository at this point in the history
  • Loading branch information
BeWorld2018 committed Jan 22, 2024
2 parents 1ab103c + 237535b commit 04560e4
Show file tree
Hide file tree
Showing 38 changed files with 1,468 additions and 287 deletions.
1 change: 1 addition & 0 deletions .github/workflows/msvc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ jobs:
set(CMAKE_SHARED_LINKER_FLAGS "-DEBUG" CACHE STRING "Linker flag for shared libraries")
cmake_minimum_required(VERSION 3.0...3.25)
project(sdl_user)
enable_testing()
add_subdirectory("{ srcdir }" SDL)
"""))
- name: Configure (CMake)
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ VisualC/visualtest/testsprite2_sample.actions
VisualC/visualtest/testsprite2_sample.config
VisualC/visualtest/testsprite2_sample.parameters
VisualC-GDK/**/Layout
VisualC-GDK/shaders/*.h

# for Android
android-project/local.properties
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -911,7 +911,7 @@ if(SDL_ASSEMBLY)

if(SDL_LSX)
cmake_push_check_state()
list(APPEND CMAKE_REQUIRED_FLAGS "-mlsx")
set(CMAKE_REQUIRED_FLAGS "-mlsx")
check_c_source_compiles("
#ifndef __loongarch_sx
#error Assembler CPP flag not enabled
Expand All @@ -928,7 +928,7 @@ if(SDL_ASSEMBLY)

if(SDL_LASX)
cmake_push_check_state()
list(APPEND CMAKE_REQUIRED_FLAGS "-mlasx")
set(CMAKE_REQUIRED_FLAGS "-mlasx")
check_c_source_compiles("
#ifndef __loongarch_asx
#error Assembler CPP flag not enabled
Expand Down
7 changes: 3 additions & 4 deletions Makefile.os2
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ SRCS+= SDL_events.c SDL_quit.c SDL_keyboard.c SDL_mouse.c SDL_windowevents.c &
SDL_clipboardevents.c SDL_dropevents.c SDL_displayevents.c SDL_gesture.c &
SDL_sensor.c SDL_touch.c
SRCS+= SDL_haptic.c SDL_hidapi.c SDL_gamecontroller.c SDL_joystick.c controller_type.c
SRCS+= SDL_render.c yuv_rgb_lsx.c yuv_rgb_sse.c yuv_rgb_std.c SDL_yuv.c SDL_yuv_sw.c SDL_blendfillrect.c &
SRCS+= SDL_render.c yuv_rgb_sse.c yuv_rgb_std.c SDL_yuv.c SDL_yuv_sw.c SDL_blendfillrect.c &
SDL_blendline.c SDL_blendpoint.c SDL_drawline.c SDL_drawpoint.c &
SDL_render_sw.c SDL_rotate.c SDL_triangle.c
SRCS+= SDL_blit.c SDL_blit_0.c SDL_blit_1.c SDL_blit_A.c SDL_blit_auto.c &
Expand Down Expand Up @@ -152,15 +152,14 @@ SDL_blendpoint.obj: SDL_blendpoint.c
wcc386 $(CFLAGS_DLL) -wcd=200 -fo=$^@ $<
SDL_RLEaccel.obj: SDL_RLEaccel.c
wcc386 $(CFLAGS_DLL) -wcd=201 -fo=$^@ $<
yuv_rgb_sse.obj: yuv_rgb_sse.c
wcc386 $(CFLAGS_DLL) -wcd=202 -fo=$^@ $<
!ifeq HIDAPI 1
# c99 mode needed because of structs with flexible array members in libusb.h
SDL_hidapi.obj: SDL_hidapi.c
wcc386 $(CFLAGS_DLL) -za99 -fo=$^@ $<
!endif

yuv_rgb_sse.obj: yuv_rgb_sse.c
wcc386 $(CFLAGS_DLL) -wcd=202 -fo=$^@ $<

$(LIBICONV_LIB): "src/core/os2/iconv2.lbc"
@echo * Creating: $@
wlib -q -b -n -c -pa -s -t -zld -ii -io $@ @$<
Expand Down
2 changes: 1 addition & 1 deletion Makefile.w32
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ SRCS+= SDL_events.c SDL_quit.c SDL_keyboard.c SDL_mouse.c SDL_windowevents.c &
SDL_clipboardevents.c SDL_dropevents.c SDL_displayevents.c SDL_gesture.c &
SDL_sensor.c SDL_touch.c
SRCS+= SDL_haptic.c SDL_hidapi.c SDL_gamecontroller.c SDL_joystick.c controller_type.c
SRCS+= SDL_render.c yuv_rgb_lsx.c yuv_rgb_sse.c yuv_rgb_std.c SDL_yuv.c SDL_yuv_sw.c SDL_blendfillrect.c &
SRCS+= SDL_render.c yuv_rgb_sse.c yuv_rgb_std.c SDL_yuv.c SDL_yuv_sw.c SDL_blendfillrect.c &
SDL_blendline.c SDL_blendpoint.c SDL_drawline.c SDL_drawpoint.c &
SDL_render_sw.c SDL_rotate.c SDL_triangle.c
SRCS+= SDL_blit.c SDL_blit_0.c SDL_blit_1.c SDL_blit_A.c SDL_blit_auto.c &
Expand Down
24 changes: 24 additions & 0 deletions VisualC-GDK/SDL/SDL.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,12 @@
<SubSystem>Windows</SubSystem>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
</Link>
<PreBuildEvent>
<Command>$(SolutionDir)\shaders\buildshaders.bat $(SolutionDir)</Command>
</PreBuildEvent>
<PreBuildEvent>
<Message>Building shader blobs (Xbox Series)</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Gaming.Xbox.XboxOne.x64'">
<Midl>
Expand Down Expand Up @@ -201,6 +207,12 @@
<SubSystem>Windows</SubSystem>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
</Link>
<PreBuildEvent>
<Command>$(SolutionDir)\shaders\buildshaders.bat $(SolutionDir) one</Command>
</PreBuildEvent>
<PreBuildEvent>
<Message>Building shader blobs (Xbox One)</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Desktop.x64'">
<Midl>
Expand Down Expand Up @@ -259,6 +271,12 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
</Link>
<PreBuildEvent>
<Command>$(SolutionDir)\shaders\buildshaders.bat $(SolutionDir)</Command>
</PreBuildEvent>
<PreBuildEvent>
<Message>Building shader blobs (Xbox Series)</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">
<Midl>
Expand Down Expand Up @@ -288,6 +306,12 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
</Link>
<PreBuildEvent>
<Command>$(SolutionDir)\shaders\buildshaders.bat $(SolutionDir) one</Command>
</PreBuildEvent>
<PreBuildEvent>
<Message>Building shader blobs (Xbox One)</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="..\..\include\begin_code.h" />
Expand Down
1 change: 1 addition & 0 deletions VisualC-GDK/clean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ find . -type f \( -name '*.bmp' -o -name '*.wav' -o -name '*.dat' \) -print -del
find . -depth -type d \( -name Gaming.Desktop.x64 \) -exec rm -rv {} \;
find . -depth -type d \( -name Gaming.Xbox.Scarlett.x64 \) -exec rm -rv {} \;
find . -depth -type d \( -name Gaming.Xbox.XboxOne.x64 \) -exec rm -rv {} \;
rm shaders/*.h
19 changes: 19 additions & 0 deletions VisualC-GDK/shaders/D3D12_PixelShader_Colors.hlsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
struct PixelShaderInput
{
float4 pos : SV_POSITION;
float2 tex : TEXCOORD0;
float4 color : COLOR0;
};

#define ColorRS \
"RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \
"DENY_DOMAIN_SHADER_ROOT_ACCESS |" \
"DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \
"DENY_HULL_SHADER_ROOT_ACCESS )," \
"RootConstants(num32BitConstants=32, b0)"

[RootSignature(ColorRS)]
float4 main(PixelShaderInput input) : SV_TARGET0
{
return input.color;
}
43 changes: 43 additions & 0 deletions VisualC-GDK/shaders/D3D12_PixelShader_NV12_BT601.hlsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
Texture2D theTextureY : register(t0);
Texture2D theTextureUV : register(t1);
SamplerState theSampler : register(s0);

struct PixelShaderInput
{
float4 pos : SV_POSITION;
float2 tex : TEXCOORD0;
float4 color : COLOR0;
};

#define NVRS \
"RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \
" DENY_DOMAIN_SHADER_ROOT_ACCESS |" \
" DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \
" DENY_HULL_SHADER_ROOT_ACCESS )," \
"RootConstants(num32BitConstants=32, b0),"\
"DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )"

[RootSignature(NVRS)]
float4 main(PixelShaderInput input) : SV_TARGET
{
const float3 offset = {-0.0627451017, -0.501960814, -0.501960814};
const float3 Rcoeff = {1.1644, 0.0000, 1.5960};
const float3 Gcoeff = {1.1644, -0.3918, -0.8130};
const float3 Bcoeff = {1.1644, 2.0172, 0.0000};

float4 Output;

float3 yuv;
yuv.x = theTextureY.Sample(theSampler, input.tex).r;
yuv.yz = theTextureUV.Sample(theSampler, input.tex).rg;

yuv += offset;
Output.r = dot(yuv, Rcoeff);
Output.g = dot(yuv, Gcoeff);
Output.b = dot(yuv, Bcoeff);
Output.a = 1.0f;

return Output * input.color;
}
43 changes: 43 additions & 0 deletions VisualC-GDK/shaders/D3D12_PixelShader_NV12_BT709.hlsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
Texture2D theTextureY : register(t0);
Texture2D theTextureUV : register(t1);
SamplerState theSampler : register(s0);

struct PixelShaderInput
{
float4 pos : SV_POSITION;
float2 tex : TEXCOORD0;
float4 color : COLOR0;
};

#define NVRS \
"RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \
" DENY_DOMAIN_SHADER_ROOT_ACCESS |" \
" DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \
" DENY_HULL_SHADER_ROOT_ACCESS )," \
"RootConstants(num32BitConstants=32, b0),"\
"DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )"

[RootSignature(NVRS)]
float4 main(PixelShaderInput input) : SV_TARGET
{
const float3 offset = {-0.0627451017, -0.501960814, -0.501960814};
const float3 Rcoeff = {1.1644, 0.0000, 1.7927};
const float3 Gcoeff = {1.1644, -0.2132, -0.5329};
const float3 Bcoeff = {1.1644, 2.1124, 0.0000};

float4 Output;

float3 yuv;
yuv.x = theTextureY.Sample(theSampler, input.tex).r;
yuv.yz = theTextureUV.Sample(theSampler, input.tex).rg;

yuv += offset;
Output.r = dot(yuv, Rcoeff);
Output.g = dot(yuv, Gcoeff);
Output.b = dot(yuv, Bcoeff);
Output.a = 1.0f;

return Output * input.color;
}
43 changes: 43 additions & 0 deletions VisualC-GDK/shaders/D3D12_PixelShader_NV12_JPEG.hlsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
Texture2D theTextureY : register(t0);
Texture2D theTextureUV : register(t1);
SamplerState theSampler : register(s0);

struct PixelShaderInput
{
float4 pos : SV_POSITION;
float2 tex : TEXCOORD0;
float4 color : COLOR0;
};

#define NVRS \
"RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \
" DENY_DOMAIN_SHADER_ROOT_ACCESS |" \
" DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \
" DENY_HULL_SHADER_ROOT_ACCESS )," \
"RootConstants(num32BitConstants=32, b0),"\
"DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )"

[RootSignature(NVRS)]
float4 main(PixelShaderInput input) : SV_TARGET
{
const float3 offset = {0.0, -0.501960814, -0.501960814};
const float3 Rcoeff = {1.0000, 0.0000, 1.4020};
const float3 Gcoeff = {1.0000, -0.3441, -0.7141};
const float3 Bcoeff = {1.0000, 1.7720, 0.0000};

float4 Output;

float3 yuv;
yuv.x = theTextureY.Sample(theSampler, input.tex).r;
yuv.yz = theTextureUV.Sample(theSampler, input.tex).rg;

yuv += offset;
Output.r = dot(yuv, Rcoeff);
Output.g = dot(yuv, Gcoeff);
Output.b = dot(yuv, Bcoeff);
Output.a = 1.0f;

return Output * input.color;
}
43 changes: 43 additions & 0 deletions VisualC-GDK/shaders/D3D12_PixelShader_NV21_BT601.hlsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
Texture2D theTextureY : register(t0);
Texture2D theTextureUV : register(t1);
SamplerState theSampler : register(s0);

struct PixelShaderInput
{
float4 pos : SV_POSITION;
float2 tex : TEXCOORD0;
float4 color : COLOR0;
};

#define NVRS \
"RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \
" DENY_DOMAIN_SHADER_ROOT_ACCESS |" \
" DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \
" DENY_HULL_SHADER_ROOT_ACCESS )," \
"RootConstants(num32BitConstants=32, b0),"\
"DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )"

[RootSignature(NVRS)]
float4 main(PixelShaderInput input) : SV_TARGET
{
const float3 offset = {-0.0627451017, -0.501960814, -0.501960814};
const float3 Rcoeff = {1.1644, 0.0000, 1.5960};
const float3 Gcoeff = {1.1644, -0.3918, -0.8130};
const float3 Bcoeff = {1.1644, 2.0172, 0.0000};

float4 Output;

float3 yuv;
yuv.x = theTextureY.Sample(theSampler, input.tex).r;
yuv.yz = theTextureUV.Sample(theSampler, input.tex).gr;

yuv += offset;
Output.r = dot(yuv, Rcoeff);
Output.g = dot(yuv, Gcoeff);
Output.b = dot(yuv, Bcoeff);
Output.a = 1.0f;

return Output * input.color;
}
43 changes: 43 additions & 0 deletions VisualC-GDK/shaders/D3D12_PixelShader_NV21_BT709.hlsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
Texture2D theTextureY : register(t0);
Texture2D theTextureUV : register(t1);
SamplerState theSampler : register(s0);

struct PixelShaderInput
{
float4 pos : SV_POSITION;
float2 tex : TEXCOORD0;
float4 color : COLOR0;
};

#define NVRS \
"RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \
" DENY_DOMAIN_SHADER_ROOT_ACCESS |" \
" DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \
" DENY_HULL_SHADER_ROOT_ACCESS )," \
"RootConstants(num32BitConstants=32, b0),"\
"DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )"

[RootSignature(NVRS)]
float4 main(PixelShaderInput input) : SV_TARGET
{
const float3 offset = {-0.0627451017, -0.501960814, -0.501960814};
const float3 Rcoeff = {1.1644, 0.0000, 1.7927};
const float3 Gcoeff = {1.1644, -0.2132, -0.5329};
const float3 Bcoeff = {1.1644, 2.1124, 0.0000};

float4 Output;

float3 yuv;
yuv.x = theTextureY.Sample(theSampler, input.tex).r;
yuv.yz = theTextureUV.Sample(theSampler, input.tex).gr;

yuv += offset;
Output.r = dot(yuv, Rcoeff);
Output.g = dot(yuv, Gcoeff);
Output.b = dot(yuv, Bcoeff);
Output.a = 1.0f;

return Output * input.color;
}
Loading

0 comments on commit 04560e4

Please sign in to comment.