Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional code review for OpenEXR #494

Merged
merged 1 commit into from
Aug 8, 2024
Merged
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
19 changes: 15 additions & 4 deletions Auxiliary/DirectXTexEXR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,14 +265,25 @@ HRESULT DirectX::GetMetadataFromEXRFile(const wchar_t* szFile, TexMetadata& meta
const auto dw = file.dataWindow();

const int width = dw.max.x - dw.min.x + 1;
const int height = dw.max.y - dw.min.y + 1;
int height = dw.max.y - dw.min.y + 1;
walbourn marked this conversation as resolved.
Show resolved Hide resolved
size_t arraySize = 1;

if (width < 1 || height < 1)
return E_FAIL;

if (file.header().find("envmap") != file.header().end())
{
if (width == height / 6)
{
height = width;
arraySize = 6;
}
}

metadata.width = static_cast<size_t>(width);
metadata.height = static_cast<size_t>(height);
metadata.depth = metadata.arraySize = metadata.mipLevels = 1;
metadata.depth = metadata.mipLevels = 1;
metadata.arraySize = arraySize;
metadata.format = DXGI_FORMAT_R16G16B16A16_FLOAT;
metadata.dimension = TEX_DIMENSION_TEXTURE2D;
}
Expand Down Expand Up @@ -371,7 +382,7 @@ HRESULT DirectX::LoadFromEXRFile(const wchar_t* szFile, TexMetadata* metadata, S

auto const dw = file.dataWindow();

int width = dw.max.x - dw.min.x + 1;
const int width = dw.max.x - dw.min.x + 1;
int height = dw.max.y - dw.min.y + 1;
size_t arraySize = 1;

Expand All @@ -383,8 +394,8 @@ HRESULT DirectX::LoadFromEXRFile(const wchar_t* szFile, TexMetadata* metadata, S
if (width == height / 6)
{
height = width;
arraySize = 6;
}
arraySize = 6;
}

if (metadata)
Expand Down
Loading