@@ -1140,6 +1140,7 @@ static SDL_bool D3D12_QueryFence(
1140
1140
SDL_GpuRenderer * driverData ,
1141
1141
SDL_GpuFence * fence )
1142
1142
{
1143
+ (void )driverData ;
1143
1144
D3D12Fence * d3d12Fence = (D3D12Fence * )fence ;
1144
1145
return ID3D12Fence_GetCompletedValue (d3d12Fence -> handle ) == D3D12_FENCE_SIGNAL_VALUE ;
1145
1146
}
@@ -2015,13 +2016,13 @@ static D3D12ComputeRootSignature *D3D12_INTERNAL_CreateComputeRootSignature(
2015
2016
SDL_zeroa (descriptorRanges );
2016
2017
SDL_zero (rootParameter );
2017
2018
2018
- d3d12ComputeRootSignature -> readOnlyStorageTextureRootIndex = -1 ;
2019
- d3d12ComputeRootSignature -> readOnlyStorageBufferRootIndex = -1 ;
2020
- d3d12ComputeRootSignature -> readWriteStorageTextureRootIndex = -1 ;
2021
- d3d12ComputeRootSignature -> readWriteStorageBufferRootIndex = -1 ;
2019
+ d3d12ComputeRootSignature -> readOnlyStorageTextureRootIndex = ( Uint32 ) - 1 ;
2020
+ d3d12ComputeRootSignature -> readOnlyStorageBufferRootIndex = ( Uint32 ) - 1 ;
2021
+ d3d12ComputeRootSignature -> readWriteStorageTextureRootIndex = ( Uint32 ) - 1 ;
2022
+ d3d12ComputeRootSignature -> readWriteStorageBufferRootIndex = ( Uint32 ) - 1 ;
2022
2023
2023
2024
for (Uint32 i = 0 ; i < MAX_UNIFORM_BUFFERS_PER_STAGE ; i += 1 ) {
2024
- d3d12ComputeRootSignature -> uniformBufferRootIndex [i ] = -1 ;
2025
+ d3d12ComputeRootSignature -> uniformBufferRootIndex [i ] = ( Uint32 ) - 1 ;
2025
2026
}
2026
2027
2027
2028
if (createInfo -> readOnlyStorageTextureCount ) {
@@ -2625,13 +2626,21 @@ static D3D12Texture *D3D12_INTERNAL_CreateTexture(
2625
2626
2626
2627
heapFlags = D3D12_HEAP_FLAG_NONE ;
2627
2628
2629
+ if (((textureCreateInfo -> depth <= 1 ) && (!textureCreateInfo -> isCube ) && (textureCreateInfo -> layerCount > UINT16_MAX ))
2630
+ || ((textureCreateInfo -> depth > 1 ) && (textureCreateInfo -> depth > UINT16_MAX ))
2631
+ || (textureCreateInfo -> levelCount > UINT16_MAX )) {
2632
+ SDL_LogError (SDL_LOG_CATEGORY_GPU , "Failed to create texture! Argument out of range." );
2633
+ D3D12_INTERNAL_DestroyTexture (renderer , texture );
2634
+ return NULL ;
2635
+ }
2636
+
2628
2637
if (textureCreateInfo -> depth <= 1 ) {
2629
2638
desc .Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D ;
2630
2639
desc .Alignment = D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT ;
2631
2640
desc .Width = textureCreateInfo -> width ;
2632
2641
desc .Height = textureCreateInfo -> height ;
2633
- desc .DepthOrArraySize = textureCreateInfo -> isCube ? 6 : textureCreateInfo -> layerCount ;
2634
- desc .MipLevels = textureCreateInfo -> levelCount ;
2642
+ desc .DepthOrArraySize = textureCreateInfo -> isCube ? 6 : ( UINT16 ) textureCreateInfo -> layerCount ;
2643
+ desc .MipLevels = ( UINT16 ) textureCreateInfo -> levelCount ;
2635
2644
desc .Format = SDLToD3D12_TextureFormat [textureCreateInfo -> format ];
2636
2645
desc .SampleDesc .Count = 1 ;
2637
2646
desc .SampleDesc .Quality = 0 ;
@@ -2642,8 +2651,8 @@ static D3D12Texture *D3D12_INTERNAL_CreateTexture(
2642
2651
desc .Alignment = D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT ;
2643
2652
desc .Width = textureCreateInfo -> width ;
2644
2653
desc .Height = textureCreateInfo -> height ;
2645
- desc .DepthOrArraySize = textureCreateInfo -> depth ;
2646
- desc .MipLevels = textureCreateInfo -> levelCount ;
2654
+ desc .DepthOrArraySize = ( UINT16 ) textureCreateInfo -> depth ;
2655
+ desc .MipLevels = ( UINT16 ) textureCreateInfo -> levelCount ;
2647
2656
desc .Format = SDLToD3D12_TextureFormat [textureCreateInfo -> format ];
2648
2657
desc .SampleDesc .Count = 1 ;
2649
2658
desc .SampleDesc .Quality = 0 ;
@@ -2761,7 +2770,7 @@ static D3D12Texture *D3D12_INTERNAL_CreateTexture(
2761
2770
rtvDesc .ViewDimension = D3D12_RTV_DIMENSION_TEXTURE3D ;
2762
2771
rtvDesc .Texture3D .MipSlice = levelIndex ;
2763
2772
rtvDesc .Texture3D .FirstWSlice = 0 ;
2764
- rtvDesc .Texture3D .WSize = -1 ; /* all depths */
2773
+ rtvDesc .Texture3D .WSize = ( UINT ) - 1 ; /* all depths */
2765
2774
} else {
2766
2775
rtvDesc .ViewDimension = D3D12_RTV_DIMENSION_TEXTURE2D ;
2767
2776
rtvDesc .Texture2D .MipSlice = levelIndex ;
@@ -3319,7 +3328,7 @@ static void D3D12_ReleaseShader(
3319
3328
SDL_GpuRenderer * driverData ,
3320
3329
SDL_GpuShader * shader )
3321
3330
{
3322
- /* D3D12Renderer *renderer = (D3D12Renderer * )driverData; */
3331
+ ( void )driverData ;
3323
3332
D3D12Shader * d3d12shader = (D3D12Shader * )shader ;
3324
3333
3325
3334
if (d3d12shader -> bytecode ) {
@@ -3718,7 +3727,7 @@ static void D3D12_BeginRenderPass(
3718
3727
subresource -> dsvHandle .cpuHandle ,
3719
3728
clearFlags ,
3720
3729
depthStencilAttachmentInfo -> depthStencilClearValue .depth ,
3721
- depthStencilAttachmentInfo -> depthStencilClearValue .stencil ,
3730
+ ( Uint8 ) depthStencilAttachmentInfo -> depthStencilClearValue .stencil ,
3722
3731
0 ,
3723
3732
NULL );
3724
3733
}
@@ -4409,6 +4418,7 @@ static void D3D12_DrawPrimitivesIndirect(
4409
4418
Uint32 drawCount ,
4410
4419
Uint32 stride )
4411
4420
{
4421
+ (void )stride ;
4412
4422
D3D12CommandBuffer * d3d12CommandBuffer = (D3D12CommandBuffer * )commandBuffer ;
4413
4423
D3D12Buffer * d3d12Buffer = ((D3D12BufferContainer * )buffer )-> activeBuffer ;
4414
4424
@@ -4431,6 +4441,7 @@ static void D3D12_DrawIndexedPrimitivesIndirect(
4431
4441
Uint32 drawCount ,
4432
4442
Uint32 stride )
4433
4443
{
4444
+ (void )stride ;
4434
4445
D3D12CommandBuffer * d3d12CommandBuffer = (D3D12CommandBuffer * )commandBuffer ;
4435
4446
D3D12Buffer * d3d12Buffer = ((D3D12BufferContainer * )buffer )-> activeBuffer ;
4436
4447
@@ -5515,6 +5526,7 @@ static SDL_bool D3D12_SupportsSwapchainComposition(
5515
5526
SDL_Window * window ,
5516
5527
SDL_GpuSwapchainComposition swapchainComposition )
5517
5528
{
5529
+ (void )window ;
5518
5530
D3D12Renderer * renderer = (D3D12Renderer * )driverData ;
5519
5531
DXGI_FORMAT format ;
5520
5532
D3D12_FEATURE_DATA_FORMAT_SUPPORT formatSupport ;
@@ -6038,6 +6050,7 @@ static SDL_GpuTextureFormat D3D12_GetSwapchainTextureFormat(
6038
6050
SDL_GpuRenderer * driverData ,
6039
6051
SDL_Window * window )
6040
6052
{
6053
+ (void )driverData ;
6041
6054
D3D12WindowData * windowData = D3D12_INTERNAL_FetchWindowData (window );
6042
6055
6043
6056
if (windowData == NULL ) {
@@ -6334,7 +6347,7 @@ static SDL_GpuTexture *D3D12_AcquireSwapchainTexture(
6334
6347
IDXGISwapChain_GetDesc (windowData -> swapchain , & swapchainDesc );
6335
6348
SDL_GetWindowSize (window , & w , & h );
6336
6349
6337
- if (w != swapchainDesc .BufferDesc .Width || h != swapchainDesc .BufferDesc .Height ) {
6350
+ if (( INT64 ) w != ( INT64 ) swapchainDesc .BufferDesc .Width || ( INT64 ) h != ( INT64 ) swapchainDesc .BufferDesc .Height ) {
6338
6351
res = D3D12_INTERNAL_ResizeSwapchain (
6339
6352
renderer ,
6340
6353
windowData ,
@@ -6686,9 +6699,14 @@ static void D3D12_Submit(
6686
6699
6687
6700
/* Acquire a fence and set it to the in-flight fence */
6688
6701
d3d12CommandBuffer -> inFlightFence = D3D12_INTERNAL_AcquireFence (renderer );
6702
+
6703
+ /* Fence creation can fail, we can't handle this nicely */
6689
6704
if (!d3d12CommandBuffer -> inFlightFence ) {
6690
6705
SDL_LogError (SDL_LOG_CATEGORY_GPU , "Failed to acquire fence." );
6706
+ SDL_assert (d3d12CommandBuffer -> inFlightFence );
6707
+ return ;
6691
6708
}
6709
+
6692
6710
/* Command buffer has a reference to the in-flight fence */
6693
6711
(void )SDL_AtomicIncRef (& d3d12CommandBuffer -> inFlightFence -> referenceCount );
6694
6712
@@ -7087,6 +7105,8 @@ static SDL_bool D3D12_PrepareDriver(SDL_VideoDevice *_this)
7087
7105
IDXGIFactory6 * factory6 ;
7088
7106
IDXGIAdapter1 * adapter ;
7089
7107
7108
+ (void )_this ;
7109
+
7090
7110
/* Can we load D3D12? */
7091
7111
7092
7112
d3d12_dll = SDL_LoadObject (D3D12_DLL );
0 commit comments