@@ -338,8 +338,8 @@ pl_starter_resize(void)
338
338
plIO * ptIO = gptIOI -> get_io ();
339
339
plSwapchainInit tDesc = {
340
340
.bVSync = true,
341
- .uWidth = (uint32_t )ptIO -> tMainViewportSize .x ,
342
- .uHeight = (uint32_t )ptIO -> tMainViewportSize .y ,
341
+ .uWidth = (uint32_t )( ptIO -> tMainViewportSize .x * ptIO -> tMainFramebufferScale . x ) ,
342
+ .uHeight = (uint32_t )( ptIO -> tMainViewportSize .y * ptIO -> tMainFramebufferScale . y ) ,
343
343
.tSampleCount = (gptStarterCtx -> tFlags & PL_STARTER_FLAGS_MSAA ) ? gptGfx -> get_device_info (gptStarterCtx -> ptDevice )-> tMaxSampleCount : 1
344
344
};
345
345
gptGfx -> recreate_swapchain (gptStarterCtx -> ptSwapchain , & tDesc );
@@ -363,7 +363,10 @@ pl_starter_resize(void)
363
363
gptGfx -> queue_texture_for_deletion (gptStarterCtx -> ptDevice , gptStarterCtx -> tDepthTexture );
364
364
365
365
const plTextureDesc tDepthTextureDesc = {
366
- .tDimensions = {gptIOI -> get_io ()-> tMainViewportSize .x , gptIOI -> get_io ()-> tMainViewportSize .y , 1 },
366
+ .tDimensions = {
367
+ gptIOI -> get_io ()-> tMainViewportSize .x * ptIO -> tMainFramebufferScale .x ,
368
+ gptIOI -> get_io ()-> tMainViewportSize .y * ptIO -> tMainFramebufferScale .y ,
369
+ 1 },
367
370
.tFormat = PL_FORMAT_D32_FLOAT_S8_UINT ,
368
371
.uLayers = 1 ,
369
372
.uMips = 1 ,
@@ -391,7 +394,10 @@ pl_starter_resize(void)
391
394
gptGfx -> queue_texture_for_deletion (gptStarterCtx -> ptDevice , gptStarterCtx -> tResolveTexture );
392
395
393
396
const plTextureDesc tDepthTextureDesc = {
394
- .tDimensions = {(float )tInfo .uWidth , (float )tInfo .uHeight , 1 },
397
+ .tDimensions = {
398
+ (float )tInfo .uWidth ,
399
+ (float )tInfo .uHeight ,
400
+ 1 },
395
401
.tFormat = tInfo .tFormat ,
396
402
.uLayers = 1 ,
397
403
.uMips = 1 ,
@@ -424,8 +430,8 @@ pl_starter_resize(void)
424
430
if (gptStarterCtx -> tFlags & PL_STARTER_FLAGS_DEPTH_BUFFER && gptStarterCtx -> tFlags & PL_STARTER_FLAGS_MSAA )
425
431
{
426
432
atMainAttachmentSets [i ].atViewAttachments [0 ] = gptStarterCtx -> tDepthTexture ;
427
- atMainAttachmentSets [i ].atViewAttachments [1 ] = gptStarterCtx -> tResolveTexture ;
428
- atMainAttachmentSets [i ].atViewAttachments [2 ] = atSwapchainImages [ i ] ;
433
+ atMainAttachmentSets [i ].atViewAttachments [1 ] = atSwapchainImages [ i ] ;
434
+ atMainAttachmentSets [i ].atViewAttachments [2 ] = gptStarterCtx -> tResolveTexture ;
429
435
}
430
436
else if (gptStarterCtx -> tFlags & PL_STARTER_FLAGS_DEPTH_BUFFER )
431
437
{
@@ -925,8 +931,8 @@ pl__starter_activate_msaa(void)
925
931
plIO * ptIO = gptIOI -> get_io ();
926
932
plSwapchainInit tDesc = {
927
933
.bVSync = true,
928
- .uWidth = (uint32_t )ptIO -> tMainViewportSize .x ,
929
- .uHeight = (uint32_t )ptIO -> tMainViewportSize .y ,
934
+ .uWidth = (uint32_t )( ptIO -> tMainViewportSize .x * ptIO -> tMainFramebufferScale . x ) ,
935
+ .uHeight = (uint32_t )( ptIO -> tMainViewportSize .y * ptIO -> tMainFramebufferScale . y ) ,
930
936
.tSampleCount = gptGfx -> get_device_info (gptStarterCtx -> ptDevice )-> tMaxSampleCount
931
937
};
932
938
gptGfx -> recreate_swapchain (gptStarterCtx -> ptSwapchain , & tDesc );
@@ -969,7 +975,10 @@ pl__starter_activate_msaa(void)
969
975
gptGfx -> queue_texture_for_deletion (gptStarterCtx -> ptDevice , gptStarterCtx -> tDepthTexture );
970
976
plBlitEncoder * ptEncoder = pl_starter_get_blit_encoder ();
971
977
const plTextureDesc tDepthTextureDesc = {
972
- .tDimensions = {gptIOI -> get_io ()-> tMainViewportSize .x , gptIOI -> get_io ()-> tMainViewportSize .y , 1 },
978
+ .tDimensions = {
979
+ gptIOI -> get_io ()-> tMainViewportSize .x * ptIO -> tMainFramebufferScale .x ,
980
+ gptIOI -> get_io ()-> tMainViewportSize .y * ptIO -> tMainFramebufferScale .y ,
981
+ 1 },
973
982
.tFormat = PL_FORMAT_D32_FLOAT_S8_UINT ,
974
983
.uLayers = 1 ,
975
984
.uMips = 1 ,
@@ -1009,8 +1018,8 @@ pl__starter_deactivate_msaa(void)
1009
1018
plIO * ptIO = gptIOI -> get_io ();
1010
1019
plSwapchainInit tDesc = {
1011
1020
.bVSync = true,
1012
- .uWidth = (uint32_t )ptIO -> tMainViewportSize .x ,
1013
- .uHeight = (uint32_t )ptIO -> tMainViewportSize .y ,
1021
+ .uWidth = (uint32_t )( ptIO -> tMainViewportSize .x * ptIO -> tMainFramebufferScale . x ) ,
1022
+ .uHeight = (uint32_t )( ptIO -> tMainViewportSize .y * ptIO -> tMainFramebufferScale . y ) ,
1014
1023
.tSampleCount = 1
1015
1024
};
1016
1025
gptGfx -> recreate_swapchain (gptStarterCtx -> ptSwapchain , & tDesc );
@@ -1024,7 +1033,10 @@ pl__starter_deactivate_msaa(void)
1024
1033
gptGfx -> queue_texture_for_deletion (gptStarterCtx -> ptDevice , gptStarterCtx -> tDepthTexture );
1025
1034
plBlitEncoder * ptEncoder = pl_starter_get_blit_encoder ();
1026
1035
const plTextureDesc tDepthTextureDesc = {
1027
- .tDimensions = {gptIOI -> get_io ()-> tMainViewportSize .x , gptIOI -> get_io ()-> tMainViewportSize .y , 1 },
1036
+ .tDimensions = {
1037
+ gptIOI -> get_io ()-> tMainViewportSize .x * ptIO -> tMainFramebufferScale .x ,
1038
+ gptIOI -> get_io ()-> tMainViewportSize .y * ptIO -> tMainFramebufferScale .y ,
1039
+ 1 },
1028
1040
.tFormat = PL_FORMAT_D32_FLOAT_S8_UINT ,
1029
1041
.uLayers = 1 ,
1030
1042
.uMips = 1 ,
@@ -1068,7 +1080,10 @@ pl__starter_activate_depth_buffer(void)
1068
1080
1069
1081
plBlitEncoder * ptEncoder = pl_starter_get_blit_encoder ();
1070
1082
const plTextureDesc tDepthTextureDesc = {
1071
- .tDimensions = {gptIOI -> get_io ()-> tMainViewportSize .x , gptIOI -> get_io ()-> tMainViewportSize .y , 1 },
1083
+ .tDimensions = {
1084
+ gptIOI -> get_io ()-> tMainViewportSize .x * gptIOI -> get_io ()-> tMainFramebufferScale .x ,
1085
+ gptIOI -> get_io ()-> tMainViewportSize .y * gptIOI -> get_io ()-> tMainFramebufferScale .y ,
1086
+ 1 },
1072
1087
.tFormat = PL_FORMAT_D32_FLOAT_S8_UINT ,
1073
1088
.uLayers = 1 ,
1074
1089
.uMips = 1 ,
@@ -1342,8 +1357,9 @@ pl__starter_create_render_pass_with_msaa_and_depth(void)
1342
1357
const plRenderPassLayoutDesc tMainRenderPassLayoutDesc = {
1343
1358
.atRenderTargets = {
1344
1359
{ .tFormat = PL_FORMAT_D32_FLOAT_S8_UINT , .bDepth = true, .tSamples = gptGfx -> get_device_info (gptStarterCtx -> ptDevice )-> tMaxSampleCount }, // depth buffer
1345
- { .tFormat = gptGfx -> get_swapchain_info (gptStarterCtx -> ptSwapchain ).tFormat , .tSamples = gptGfx -> get_device_info (gptStarterCtx -> ptDevice )-> tMaxSampleCount }, // msaa
1346
1360
{ .tFormat = gptGfx -> get_swapchain_info (gptStarterCtx -> ptSwapchain ).tFormat , .bResolve = true }, // swapchain
1361
+ { .tFormat = gptGfx -> get_swapchain_info (gptStarterCtx -> ptSwapchain ).tFormat , .tSamples = gptGfx -> get_device_info (gptStarterCtx -> ptDevice )-> tMaxSampleCount }, // msaa
1362
+
1347
1363
1348
1364
},
1349
1365
.atSubpasses = {
@@ -1395,7 +1411,7 @@ pl__starter_create_render_pass_with_msaa_and_depth(void)
1395
1411
.atColorTargets = {
1396
1412
{
1397
1413
.tLoadOp = PL_LOAD_OP_CLEAR ,
1398
- .tStoreOp = PL_STORE_OP_STORE ,
1414
+ .tStoreOp = PL_STORE_OP_STORE_MULTISAMPLE_RESOLVE ,
1399
1415
.tCurrentUsage = PL_TEXTURE_USAGE_UNSPECIFIED ,
1400
1416
.tNextUsage = PL_TEXTURE_USAGE_PRESENT ,
1401
1417
.tClearColor = {0.0f , 0.0f , 0.0f , 1.0f }
@@ -1418,8 +1434,9 @@ pl__starter_create_render_pass_with_msaa_and_depth(void)
1418
1434
for (uint32_t i = 0 ; i < uImageCount ; i ++ )
1419
1435
{
1420
1436
atMainAttachmentSets [i ].atViewAttachments [0 ] = gptStarterCtx -> tDepthTexture ;
1421
- atMainAttachmentSets [i ].atViewAttachments [1 ] = gptStarterCtx -> tResolveTexture ;
1422
- atMainAttachmentSets [i ].atViewAttachments [2 ] = atSwapchainImages [i ];
1437
+ atMainAttachmentSets [i ].atViewAttachments [1 ] = atSwapchainImages [i ];
1438
+ atMainAttachmentSets [i ].atViewAttachments [2 ] = gptStarterCtx -> tResolveTexture ;
1439
+
1423
1440
}
1424
1441
gptStarterCtx -> tRenderPass = gptGfx -> create_render_pass (gptStarterCtx -> ptDevice , & tMainRenderPassDesc , atMainAttachmentSets );
1425
1442
0 commit comments