@@ -453,7 +453,8 @@ struct D3D11Texture
453
453
454
454
typedef struct D3D11TextureContainer
455
455
{
456
- SDL_GpuTextureCreateInfo createInfo ;
456
+ TextureCommonHeader header ;
457
+
457
458
D3D11Texture * activeTexture ;
458
459
SDL_bool canBeCycled ;
459
460
@@ -2292,8 +2293,8 @@ static SDL_GpuTexture *D3D11_CreateTexture(
2292
2293
}
2293
2294
2294
2295
container = SDL_malloc (sizeof (D3D11TextureContainer ));
2296
+ container -> header .info = * textureCreateInfo ;
2295
2297
container -> canBeCycled = 1 ;
2296
- container -> createInfo = * textureCreateInfo ;
2297
2298
container -> activeTexture = texture ;
2298
2299
container -> textureCapacity = 1 ;
2299
2300
container -> textureCount = 1 ;
@@ -2330,7 +2331,7 @@ static void D3D11_INTERNAL_CycleActiveTexture(
2330
2331
2331
2332
container -> textures [container -> textureCount ] = D3D11_INTERNAL_CreateTexture (
2332
2333
renderer ,
2333
- & container -> createInfo ,
2334
+ & container -> header . info ,
2334
2335
NULL );
2335
2336
container -> textureCount += 1 ;
2336
2337
@@ -2349,7 +2350,7 @@ static D3D11TextureSubresource *D3D11_INTERNAL_FetchTextureSubresource(
2349
2350
Uint32 layer ,
2350
2351
Uint32 level )
2351
2352
{
2352
- Uint32 index = D3D11_INTERNAL_CalcSubresource (level , layer , container -> createInfo .levelCount );
2353
+ Uint32 index = D3D11_INTERNAL_CalcSubresource (level , layer , container -> header . info .levelCount );
2353
2354
return & container -> activeTexture -> subresources [index ];
2354
2355
}
2355
2356
@@ -2761,7 +2762,7 @@ static void D3D11_UploadToTexture(
2761
2762
D3D11TransferBufferContainer * srcTransferContainer = (D3D11TransferBufferContainer * )source -> transferBuffer ;
2762
2763
D3D11TransferBuffer * srcTransferBuffer = srcTransferContainer -> activeBuffer ;
2763
2764
D3D11TextureContainer * dstTextureContainer = (D3D11TextureContainer * )destination -> textureSlice .texture ;
2764
- SDL_GpuTextureFormat dstFormat = dstTextureContainer -> createInfo .format ;
2765
+ SDL_GpuTextureFormat dstFormat = dstTextureContainer -> header . info .format ;
2765
2766
Uint32 bufferStride = source -> imagePitch ;
2766
2767
Uint32 bufferImageHeight = source -> imageHeight ;
2767
2768
Sint32 w = destination -> w ;
@@ -2902,7 +2903,7 @@ static void D3D11_DownloadFromTexture(
2902
2903
D3D11TransferBufferContainer * dstTransferContainer = (D3D11TransferBufferContainer * )destination -> transferBuffer ;
2903
2904
D3D11TransferBuffer * d3d11TransferBuffer = dstTransferContainer -> activeBuffer ;
2904
2905
D3D11TextureContainer * srcTextureContainer = (D3D11TextureContainer * )source -> textureSlice .texture ;
2905
- SDL_GpuTextureFormat srcFormat = srcTextureContainer -> createInfo .format ;
2906
+ SDL_GpuTextureFormat srcFormat = srcTextureContainer -> header . info .format ;
2906
2907
D3D11_TEXTURE2D_DESC stagingDesc2D ;
2907
2908
D3D11_TEXTURE3D_DESC stagingDesc3D ;
2908
2909
D3D11TextureSubresource * textureSubresource = D3D11_INTERNAL_FetchTextureSubresource (
@@ -3531,7 +3532,7 @@ static void D3D11_BeginRenderPass(
3531
3532
d3d11CommandBuffer -> colorTargetResolveTexture [i ] = subresource -> parent ;
3532
3533
d3d11CommandBuffer -> colorTargetResolveSubresourceIndex [i ] = subresource -> index ;
3533
3534
d3d11CommandBuffer -> colorTargetMsaaHandle [i ] = subresource -> msaaHandle ;
3534
- d3d11CommandBuffer -> colorTargetMsaaFormat [i ] = SDLToD3D11_TextureFormat [container -> createInfo .format ];
3535
+ d3d11CommandBuffer -> colorTargetMsaaFormat [i ] = SDLToD3D11_TextureFormat [container -> header . info .format ];
3535
3536
3536
3537
rtvs [i ] = subresource -> msaaTargetView ;
3537
3538
} else {
@@ -3605,8 +3606,8 @@ static void D3D11_BeginRenderPass(
3605
3606
/* The viewport cannot be larger than the smallest attachment. */
3606
3607
for (Uint32 i = 0 ; i < colorAttachmentCount ; i += 1 ) {
3607
3608
D3D11TextureContainer * container = (D3D11TextureContainer * )colorAttachmentInfos [i ].textureSlice .texture ;
3608
- Uint32 w = container -> createInfo .width >> colorAttachmentInfos [i ].textureSlice .mipLevel ;
3609
- Uint32 h = container -> createInfo .height >> colorAttachmentInfos [i ].textureSlice .mipLevel ;
3609
+ Uint32 w = container -> header . info .width >> colorAttachmentInfos [i ].textureSlice .mipLevel ;
3610
+ Uint32 h = container -> header . info .height >> colorAttachmentInfos [i ].textureSlice .mipLevel ;
3610
3611
3611
3612
if (w < vpWidth ) {
3612
3613
vpWidth = w ;
@@ -3619,8 +3620,8 @@ static void D3D11_BeginRenderPass(
3619
3620
3620
3621
if (depthStencilAttachmentInfo != NULL ) {
3621
3622
D3D11TextureContainer * container = (D3D11TextureContainer * )depthStencilAttachmentInfo -> textureSlice .texture ;
3622
- Uint32 w = container -> createInfo .width >> depthStencilAttachmentInfo -> textureSlice .mipLevel ;
3623
- Uint32 h = container -> createInfo .height >> depthStencilAttachmentInfo -> textureSlice .mipLevel ;
3623
+ Uint32 w = container -> header . info .width >> depthStencilAttachmentInfo -> textureSlice .mipLevel ;
3624
+ Uint32 h = container -> header . info .height >> depthStencilAttachmentInfo -> textureSlice .mipLevel ;
3624
3625
3625
3626
if (w < vpWidth ) {
3626
3627
vpWidth = w ;
@@ -4243,7 +4244,7 @@ static void D3D11_Blit(
4243
4244
SDL_GpuViewport viewport ;
4244
4245
SDL_GpuTextureSamplerBinding textureSamplerBinding ;
4245
4246
4246
- if (destinationTextureContainer -> createInfo .depth > 1 ) {
4247
+ if (destinationTextureContainer -> header . info .depth > 1 ) {
4247
4248
SDL_LogError (SDL_LOG_CATEGORY_GPU , "3D blit destination not implemented!" );
4248
4249
return ;
4249
4250
}
@@ -4256,11 +4257,11 @@ static void D3D11_Blit(
4256
4257
4257
4258
/* If the entire destination is blitted, we don't have to load */
4258
4259
if (
4259
- destinationTextureContainer -> createInfo .layerCount == 1 &&
4260
- destinationTextureContainer -> createInfo .levelCount == 1 &&
4261
- destination -> w == destinationTextureContainer -> createInfo .width &&
4262
- destination -> h == destinationTextureContainer -> createInfo .height &&
4263
- destination -> d == destinationTextureContainer -> createInfo .depth ) {
4260
+ destinationTextureContainer -> header . info .layerCount == 1 &&
4261
+ destinationTextureContainer -> header . info .levelCount == 1 &&
4262
+ destination -> w == destinationTextureContainer -> header . info .width &&
4263
+ destination -> h == destinationTextureContainer -> header . info .height &&
4264
+ destination -> d == destinationTextureContainer -> header . info .depth ) {
4264
4265
colorAttachmentInfo .loadOp = SDL_GPU_LOADOP_DONT_CARE ;
4265
4266
} else {
4266
4267
colorAttachmentInfo .loadOp = SDL_GPU_LOADOP_LOAD ;
@@ -4289,14 +4290,14 @@ static void D3D11_Blit(
4289
4290
& viewport );
4290
4291
4291
4292
if (
4292
- sourceTextureContainer -> createInfo .layerCount == 1 &&
4293
- sourceTextureContainer -> createInfo .depth == 1 ) {
4293
+ sourceTextureContainer -> header . info .layerCount == 1 &&
4294
+ sourceTextureContainer -> header . info .depth == 1 ) {
4294
4295
/* 2D source */
4295
4296
D3D11_BindGraphicsPipeline (
4296
4297
commandBuffer ,
4297
4298
renderer -> blitFrom2DPipeline );
4298
4299
} else if (
4299
- sourceTextureContainer -> createInfo .layerCount > 1 ) {
4300
+ sourceTextureContainer -> header . info .layerCount > 1 ) {
4300
4301
/* 2D array source */
4301
4302
D3D11_BindGraphicsPipeline (
4302
4303
commandBuffer ,
@@ -4352,7 +4353,7 @@ static void D3D11_BeginComputePass(
4352
4353
4353
4354
for (i = 0 ; i < storageTextureBindingCount ; i += 1 ) {
4354
4355
textureContainer = (D3D11TextureContainer * )storageTextureBindings [i ].textureSlice .texture ;
4355
- if (!(textureContainer -> createInfo .usageFlags & SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_WRITE_BIT )) {
4356
+ if (!(textureContainer -> header . info .usageFlags & SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_WRITE_BIT )) {
4356
4357
SDL_LogError (SDL_LOG_CATEGORY_GPU , "Attempted to bind read-only texture as compute write texture" );
4357
4358
}
4358
4359
@@ -5225,16 +5226,16 @@ static SDL_bool D3D11_INTERNAL_CreateSwapchain(
5225
5226
windowData -> textureContainer .textureCount = 1 ;
5226
5227
windowData -> textureContainer .textureCapacity = 1 ;
5227
5228
5228
- windowData -> textureContainer .createInfo .depth = 1 ;
5229
- windowData -> textureContainer .createInfo .format = SwapchainCompositionToSDLTextureFormat [windowData -> swapchainComposition ];
5230
- windowData -> textureContainer .createInfo .isCube = SDL_FALSE ;
5231
- windowData -> textureContainer .createInfo .layerCount = 1 ;
5232
- windowData -> textureContainer .createInfo .levelCount = 1 ;
5233
- windowData -> textureContainer .createInfo .sampleCount = SDL_GPU_SAMPLECOUNT_1 ;
5234
- windowData -> textureContainer .createInfo .usageFlags = SDL_GPU_TEXTUREUSAGE_COLOR_TARGET_BIT |
5235
- SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_READ_BIT |
5236
- SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ_BIT |
5237
- SDL_GPU_TEXTUREUSAGE_SAMPLER_BIT ;
5229
+ windowData -> textureContainer .header . info .depth = 1 ;
5230
+ windowData -> textureContainer .header . info .format = SwapchainCompositionToSDLTextureFormat [windowData -> swapchainComposition ];
5231
+ windowData -> textureContainer .header . info .isCube = SDL_FALSE ;
5232
+ windowData -> textureContainer .header . info .layerCount = 1 ;
5233
+ windowData -> textureContainer .header . info .levelCount = 1 ;
5234
+ windowData -> textureContainer .header . info .sampleCount = SDL_GPU_SAMPLECOUNT_1 ;
5235
+ windowData -> textureContainer .header . info .usageFlags = SDL_GPU_TEXTUREUSAGE_COLOR_TARGET_BIT |
5236
+ SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_READ_BIT |
5237
+ SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ_BIT |
5238
+ SDL_GPU_TEXTUREUSAGE_SAMPLER_BIT ;
5238
5239
5239
5240
return SDL_TRUE ;
5240
5241
}
@@ -5488,8 +5489,8 @@ static SDL_GpuTexture *D3D11_AcquireSwapchainTexture(
5488
5489
* pHeight = h ;
5489
5490
5490
5491
/* Update the texture container dimensions */
5491
- windowData -> textureContainer .createInfo .width = w ;
5492
- windowData -> textureContainer .createInfo .height = h ;
5492
+ windowData -> textureContainer .header . info .width = w ;
5493
+ windowData -> textureContainer .header . info .height = h ;
5493
5494
5494
5495
/* Set up presentation */
5495
5496
if (d3d11CommandBuffer -> windowDataCount == d3d11CommandBuffer -> windowDataCapacity ) {
@@ -5516,7 +5517,7 @@ static SDL_GpuTextureFormat D3D11_GetSwapchainTextureFormat(
5516
5517
return 0 ;
5517
5518
}
5518
5519
5519
- return windowData -> textureContainer .createInfo .format ;
5520
+ return windowData -> textureContainer .header . info .format ;
5520
5521
}
5521
5522
5522
5523
static SDL_bool D3D11_SetSwapchainParameters (
0 commit comments