@@ -382,7 +382,6 @@ pl_resource_load_ex(const char* pcName, plResourceLoadFlags tFlags, uint8_t* puO
382382
383383 bool bResizeNeeded = false;
384384 bool bGenerateMips = true;
385- bool bAttemptCompression = true;
386385 plImageInfo tImageInfo = {0 };
387386 size_t szStagingOffset = 0 ;
388387 if (gptImage -> get_info ((unsigned char * )puFileData , (int )szFileByteSize , & tImageInfo ))
@@ -488,7 +487,7 @@ pl_resource_load_ex(const char* pcName, plResourceLoadFlags tFlags, uint8_t* puO
488487
489488 tResource .tTexture = gptGfx -> create_texture (ptDevice , & tTextureDesc , & ptTexture );
490489 }
491- else if (bAttemptCompression )
490+ else if (tFlags & PL_RESOURCE_LOAD_FLAG_BLOCK_COMPRESSED )
492491 {
493492 unsigned char * puRawBytes = gptImage -> load ((unsigned char * )puFileData , (int )szFileByteSize , & iTextureWidth , & iTextureHeight , & iTextureChannels , 4 );
494493
@@ -503,7 +502,7 @@ pl_resource_load_ex(const char* pcName, plResourceLoadFlags tFlags, uint8_t* puO
503502 // create texture
504503 const plTextureDesc tTextureDesc = {
505504 .tDimensions = {(float )tImageInfo .iWidth , (float )tImageInfo .iHeight , 1 },
506- .tFormat = PL_FORMAT_BC2_UNORM ,
505+ .tFormat = PL_FORMAT_BC3_UNORM ,
507506 .uLayers = 1 ,
508507 .uMips = 0 ,
509508 .tType = PL_TEXTURE_TYPE_2D ,
@@ -548,9 +547,6 @@ pl_resource_load_ex(const char* pcName, plResourceLoadFlags tFlags, uint8_t* puO
548547 pl__resource_create_staging_buffer (szRequiredStagingSize );
549548 }
550549
551-
552-
553-
554550 plBuffer * ptStagingBuffer = gptGfx -> get_buffer (ptDevice , gptResourceManager -> tStagingBuffer .tStagingBufferHandle );
555551
556552 gptDxt -> compress (& tDxtInfoOriginal , (uint8_t * )& ptStagingBuffer -> tMemoryAllocation .pHostMapped [szStagingOffset ], & szRequiredStagingSize );
@@ -562,8 +558,6 @@ pl_resource_load_ex(const char* pcName, plResourceLoadFlags tFlags, uint8_t* puO
562558 auWorkingBuffer [1 ] = puRawBytes ;
563559 memset (auWorkingBuffer [0 ], 0 , szMaxBufferSize );
564560
565-
566-
567561 const plBufferImageCopy tBufferImageCopy0 = {
568562 .uImageWidth = (uint32_t )tImageInfo .iWidth ,
569563 .uImageHeight = (uint32_t )tImageInfo .iHeight ,
@@ -615,7 +609,6 @@ pl_resource_load_ex(const char* pcName, plResourceLoadFlags tFlags, uint8_t* puO
615609 uint8_t uBlue = (ptPixel0 [2 ] + ptPixel1 [2 ] + ptPixel2 [2 ] + ptPixel3 [2 ]) / 4 ;
616610 uint8_t uAlpha = (ptPixel0 [3 ] + ptPixel1 [3 ] + ptPixel2 [3 ] + ptPixel3 [3 ]) / 4 ;
617611
618-
619612 puDstBuffer [j * iCurrentWidth * 4 + i * 4 + 0 ] = uRed ;
620613 puDstBuffer [j * iCurrentWidth * 4 + i * 4 + 1 ] = uGreen ;
621614 puDstBuffer [j * iCurrentWidth * 4 + i * 4 + 2 ] = uBlue ;
@@ -647,7 +640,11 @@ pl_resource_load_ex(const char* pcName, plResourceLoadFlags tFlags, uint8_t* puO
647640 .uMipLevel = uMipLevel
648641 };
649642
650- gptGfx -> copy_buffer_to_texture (ptBlitEncoder , gptResourceManager -> tStagingBuffer .tStagingBufferHandle , tResource .tTexture , 1 , & tBufferImageCopy );
643+ gptGfx -> copy_buffer_to_texture (ptBlitEncoder ,
644+ gptResourceManager -> tStagingBuffer .tStagingBufferHandle ,
645+ tResource .tTexture ,
646+ 1 ,
647+ & tBufferImageCopy );
651648 szStagingOffset += szCurrentSize ;
652649 }
653650
@@ -702,7 +699,7 @@ pl_resource_load_ex(const char* pcName, plResourceLoadFlags tFlags, uint8_t* puO
702699 tResource .tTexture = gptGfx -> create_texture (ptDevice , & tTextureDesc , & ptTexture );
703700 }
704701
705- if (!bAttemptCompression )
702+ if (!( tFlags & PL_RESOURCE_LOAD_FLAG_BLOCK_COMPRESSED ) )
706703 {
707704
708705 // choose allocator
0 commit comments