Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Source/RuntimeImageLoader/Private/Helpers/WEBPGIFLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,13 @@ bool FWEBPGIFLoader::DecodeGIF(TArray<uint8>&& GifBytes)

TextureData.SetNumZeroed(GetWidth() * GetHeight());

uint8_t* DecodedData = WebPDecodeRGBA(GifBytes.GetData(), GifBytes.Num(), &Width, &Height);
uint8_t* DecodedData = nullptr;

#if PLATFORM_WINDOWS
DecodedData = WebPDecodeBGRA(GifBytes.GetData(), GifBytes.Num(), &Width, &Height); // Unreal on Windows will most often use DirectX so prefer BGRA, otherwise devs should change this line!
#else
DecodedData = WebPDecodeRGBA(GifBytes.GetData(), GifBytes.Num(), &Width, &Height); // Default to RGBA for other platforms (Mobile, Vulkan, etc.)
#endif
if (DecodedData == nullptr)
{
SetError("Failed to decode .webp file. Please check input data is valid!");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ void FAnimatedTextureResource::InitRHI(FRHICommandListBase& RHICmdList)
.SetNumSamples(1)
.SetFlags(Flags)
.SetInitialState(ERHIAccess::Unknown)
.SetBulkData(FirstFrameData ? &GifBulkData : nullptr)
.SetInitActionBulkData(FirstFrameData ? &GifBulkData : nullptr)
);
#elif (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION > 0)
FRHIResourceCreateInfo CreateInfo(*Name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ FTexture2DRHIRef FRuntimeRHITexture2DFactory::CreateRHITexture2D_Windows()
.SetNumSamples(1)
.SetFlags(TextureFlags)
.SetInitialState(ERHIAccess::Unknown)
.SetBulkData(&TextureData)
.SetInitActionBulkData(&TextureData)
);
#elif (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION > 0)
FRHIResourceCreateInfo CreateInfo(TEXT("RuntimeImageReaderTextureData"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ FTextureCubeRHIRef FRuntimeRHITextureCubeFactory::CreateTextureCubeRHI_Windows()
.SetNumMips(1)
.SetFlags(TextureFlags)
.SetInitialState(ERHIAccess::Unknown)
.SetBulkData(&TextureCubeData)
.SetInitActionBulkData(&TextureCubeData)
);
#elif (ENGINE_MAJOR_VERSION == 5) && (ENGINE_MINOR_VERSION > 0)
FRHIResourceCreateInfo CreateInfo(TEXT("RuntimeImageReader_TextureCubeData"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void FRuntimeTextureResource::ReleaseRHI()
{
if (IsValid(Owner))
{
RHIUpdateTextureReference(Owner->TextureReference.TextureReferenceRHI, nullptr);
RHIClearTextureReference(Owner->TextureReference.TextureReferenceRHI);
}
FTextureResource::ReleaseRHI();

Expand Down