@@ -1375,7 +1375,9 @@ static void SDLGPU_INTERNAL_GenerateVertexInputInfo(
1375
1375
{
1376
1376
element = vertexDeclaration .elements [j ];
1377
1377
usage = element .vertexElementUsage ;
1378
+ SDL_assert (usage < MOJOSHADER_USAGE_TOTAL );
1378
1379
index = element .usageIndex ;
1380
+ SDL_assert (index < sizeof (attrUse [usage ]));
1379
1381
1380
1382
if (attrUse [usage ][index ])
1381
1383
{
@@ -1834,7 +1836,9 @@ static void SDLGPU_VerifyVertexSampler(
1834
1836
1835
1837
if (vertShader )
1836
1838
{
1837
- samplerType = MOJOSHADER_sdlGetShaderParseData (vertShader )-> samplers [index ].type ;
1839
+ MOJOSHADER_parseData * parseData = MOJOSHADER_sdlGetShaderParseData (vertShader );
1840
+ SDL_assert (parseData );
1841
+ samplerType = parseData -> samplers [index ].type ;
1838
1842
1839
1843
if (samplerType == MOJOSHADER_SAMPLER_2D )
1840
1844
{
@@ -1896,7 +1900,9 @@ static void SDLGPU_VerifySampler(
1896
1900
1897
1901
if (fragShader )
1898
1902
{
1899
- samplerType = MOJOSHADER_sdlGetShaderParseData (fragShader )-> samplers [index ].type ;
1903
+ MOJOSHADER_parseData * parseData = MOJOSHADER_sdlGetShaderParseData (fragShader );
1904
+ SDL_assert (parseData );
1905
+ samplerType = parseData -> samplers [index ].type ;
1900
1906
if (samplerType == MOJOSHADER_SAMPLER_2D )
1901
1907
{
1902
1908
renderer -> fragmentTextureSamplerBindings [index ].texture = renderer -> dummyTexture2D ;
@@ -2640,7 +2646,7 @@ static void SDLGPU_ResetBackbuffer(
2640
2646
{
2641
2647
if (presentationParameters -> backBufferFormat == FNA3D_SURFACEFORMAT_RGBA1010102 )
2642
2648
{
2643
- swapchainComposition = SDL_GPU_SWAPCHAINCOMPOSITION_HDR10_ST2048 ;
2649
+ swapchainComposition = SDL_GPU_SWAPCHAINCOMPOSITION_HDR10_ST2084 ;
2644
2650
}
2645
2651
else if ( presentationParameters -> backBufferFormat == FNA3D_SURFACEFORMAT_HALFVECTOR4 ||
2646
2652
presentationParameters -> backBufferFormat == FNA3D_SURFACEFORMAT_HDRBLENDABLE )
@@ -4035,17 +4041,35 @@ static void SDLGPU_GetSysRenderer(
4035
4041
FNA3D_Renderer * driverData ,
4036
4042
FNA3D_SysRendererEXT * sysrenderer
4037
4043
) {
4038
- /* TODO */
4044
+ SDLGPU_Renderer * renderer = (SDLGPU_Renderer * )driverData ;
4045
+
4039
4046
SDL_memset (sysrenderer , '\0' , sizeof (FNA3D_SysRendererEXT ));
4040
4047
sysrenderer -> rendererType = FNA3D_RENDERER_TYPE_SDL_GPU_EXT ;
4048
+ sysrenderer -> renderer .sdl .device = renderer -> device ;
4049
+ // FIXME: Expose other necessary pointers. -kg
4041
4050
}
4042
4051
4043
4052
static FNA3D_Texture * SDLGPU_CreateSysTexture (
4044
4053
FNA3D_Renderer * driverData ,
4045
4054
FNA3D_SysTextureEXT * systexture
4046
4055
) {
4047
- /* TODO */
4048
- return NULL ;
4056
+ SDLGPU_TextureHandle * result ;
4057
+
4058
+ if (systexture -> rendererType != FNA3D_RENDERER_TYPE_SDL_GPU_EXT )
4059
+ {
4060
+ return NULL ;
4061
+ }
4062
+
4063
+ result = (SDLGPU_TextureHandle * )SDL_malloc (sizeof (SDLGPU_TextureHandle ));
4064
+ SDL_zerop (result );
4065
+
4066
+ SDL_assert (systexture -> texture .sdl .texture );
4067
+ result -> texture = systexture -> texture .sdl .texture ;
4068
+ SDL_assert (systexture -> texture .sdl .createInfo );
4069
+ result -> createInfo = * (SDL_GPUTextureCreateInfo * )systexture -> texture .sdl .createInfo ;
4070
+ result -> boundAsRenderTarget = 0 ;
4071
+
4072
+ return (FNA3D_Texture * )result ;
4049
4073
}
4050
4074
4051
4075
/* Destroy */
@@ -4060,8 +4084,10 @@ static void SDLGPU_DestroyDevice(FNA3D_Device *device)
4060
4084
4061
4085
SDLGPU_INTERNAL_FlushCommands (renderer );
4062
4086
// avoid command buffer leaks by explicitly canceling newly-acquired command buffers
4087
+ /*
4063
4088
SDL_CancelGPUCommandBuffer(renderer->uploadCommandBuffer);
4064
4089
SDL_CancelGPUCommandBuffer(renderer->renderCommandBuffer);
4090
+ */
4065
4091
SDL_WaitForGPUIdle (renderer -> device );
4066
4092
4067
4093
SDL_UnlockMutex (renderer -> copyPassMutex );
@@ -4221,7 +4247,7 @@ static FNA3D_Device* SDLGPU_CreateDevice(
4221
4247
{
4222
4248
if (presentationParameters -> backBufferFormat == FNA3D_SURFACEFORMAT_RGBA1010102 )
4223
4249
{
4224
- swapchainComposition = SDL_GPU_SWAPCHAINCOMPOSITION_HDR10_ST2048 ;
4250
+ swapchainComposition = SDL_GPU_SWAPCHAINCOMPOSITION_HDR10_ST2084 ;
4225
4251
}
4226
4252
else if ( presentationParameters -> backBufferFormat == FNA3D_SURFACEFORMAT_HALFVECTOR4 ||
4227
4253
presentationParameters -> backBufferFormat == FNA3D_SURFACEFORMAT_HDRBLENDABLE )
0 commit comments