Comments (8)
Maybe this helps you build and debug: https://github.com/kopaka1822/ImageViewer/blob/master/Docs/build.md
from imageviewer.
Hello,
this is an interesting issue. Unfortunately, I am not able to reproduce it, neither with 3.3 nor 3.4 (the hi_mark.ktx works for me).
Both .ktx (<2.0) and .gli files are loaded with gli: https://github.com/g-truc/gli
ktx v2 is loaded differently via libktx.
Do .ktx2 files work for you? If so, the problem has probably something to do with gli.
If you want to help me track down the error, you could download the newest version of gli from the githib and just run:
#include <gli/gli.hpp>
int main()
{
gli::texture Texture = gli::load("hi_mark.ktx");
return 0;
}
if this crashes with a similar error, then we might be able to find the error quickly.
Otherwise I might actually need a stack trace to narrow down the error.
from imageviewer.
If you want to help me track down the error,
Gladly. I tried a few KTX2 files:
✅ https://github.com/KhronosGroup/KTX-Software/blob/master/tests/testimages/rgba-reference-u.ktx2
✅ https://github.com/KhronosGroup/KTX-Software/blob/master/tests/testimages/cyan_rgba_reference_u.ktx2
❌ https://github.com/KhronosGroup/KTX-Software/blob/master/tests/testimages/CesiumLogoFlat.ktx2
"error in D:\src\Pikselai\testdata\Khronos Texture\CesiumLogoFlat.ktx2: failed to transcode basis: File data is inconsistent with KTX spec."
I might actually need a stack trace to narrow down the error.
Turns out I added C# support after all for a different project. So I tried building the image viewer:
- Recursed all submodules, due to missing files.
- Retargeted the .NET version (from v4.6.1 to v4.7.2 which I used)
- Pacified some build errors (
LanzosScalingShader.cs(31,23,31,42): error CS0227: Unsafe code may only appear if compiling with /unsafe
). - Currently trying to fix
framework.h(46,10): fatal error C1083: Cannot open include file: 'gli/format.hpp'
. I see the file under "Kopaka1822ImageViewer\dependencies\gli\gli\format.hpp", but it's not finding it. Attempted to run the .exe anyway, just to see if it truly mattered, evidently it does :bUnable to load DLL 'DxImageLoader.dll'
. So, task for another day :). Cheers.
from imageviewer.
Did you build the project with x64? This is the only configuration where all include directories etc. are correctly configured.
Also, I should probably add a "How to build" page
from imageviewer.
Did you build the project with x64?
👍 Yeah, that was the only issue - don't leave it set to "AnyCPU". The build instructions will be good for others too.
the problem has probably something to do with gli.
Indeed, the issue is in GLI. So I'm closing this (and should probably open an issue here instead: https://github.com/g-truc/gli).
I tried "hi_mark.ktx" from here https://github.com/KhronosGroup/KTX-Software/blob/53aa501d12611543141fc7a4f67f03e53cefd83c/tests/testimages/hi_mark.ktx (not the latest file, which has been updated), and I get:
---------------------------
Microsoft Visual C++ Runtime Library
---------------------------
Assertion failed!
Program: ...\Kopaka1822ImageViewer\x64\Debug\DxImageLoader.dll
File: D:\srcex\Kopaka1822ImageViewer\dependenc...\load_ktx.inl
Line: 67
Expression: (Format != gli::FORMAT_UNDEFINED)
DxImageLoader.dll!_wassert(const wchar_t * expression, const wchar_t * file_name, unsigned int line_number) Line 444 C++
> DxImageLoader.dll!gli::detail::load_ktx10(const char * Data, unsigned __int64 Size) Line 67 C++
DxImageLoader.dll!gli::load_ktx(const char * Data, unsigned __int64 Size) Line 108 C++
DxImageLoader.dll!gli::load(const char * Data, unsigned __int64 Size) Line 22 C++
DxImageLoader.dll!gli::load(const char * Filename) Line 47 C++
DxImageLoader.dll!gli_load(const char * filename) Line 12 C++
DxImageLoader.dll!image_open(const char * filename) Line 74 C++
...
ImageFramework.dll!ImageFramework.ImageLoader.Resource.Resource(string file) Line 16 C#
ImageFramework.dll!ImageFramework.ImageLoader.IO.LoadImage(string file) Line 41 C#
ImageFramework.dll!ImageFramework.ImageLoader.IO.LoadImageTexture(string file, out ImageFramework.ImageLoader.GliFormat originalFormat) Line 53 C#
ImageFramework.dll!ImageFramework.ImageLoader.IO.LoadImageTextureAsync.AnonymousMethod__0() Line 78 C#
inline texture load_ktx10(char const* Data, std::size_t Size)
{
detail::ktx_header10 const & Header(*reinterpret_cast<detail::ktx_header10 const*>(Data));
size_t Offset = sizeof(detail::ktx_header10);
// Skip key value data
Offset += Header.BytesOfKeyValueData;
gl GL(gl::PROFILE_KTX);
gli::format const Format = GL.find(
static_cast<gli::gl::internal_format>(Header.GLInternalFormat),
static_cast<gli::gl::external_format>(Header.GLFormat),
static_cast<gli::gl::type_format>(Header.GLType));
GLI_ASSERT(Format != gli::FORMAT_UNDEFINED); <-------------------------
However, if update to the latest "hi_mark.ktx" from the link above that I shared with you (I was actually using an older version that I had downloaded earlier), then it loads fine. The other DDS file I tried shows the same stack too in gli. It's just coincidence that the first four files I tried with your image viewer happen to not be supported by gli 😋. Thanks. Cheers from near Seattle.
from imageviewer.
p.s. The actual division by zero originates here:
dependencies\gli\external\glm\ext\scalar_integer.inl
template<>
struct compute_ceilMultiple<false, true>
{
template<typename genType>
GLM_FUNC_QUALIFIER static genType call(genType Source, genType Multiple)
{
assert(Multiple > genType(0));
if(Source > genType(0))
{
genType Tmp = Source - genType(1);
return Tmp + (Multiple - (Tmp % Multiple));
}
else
return Source + (-Source % Multiple); <----------------- "Multiple" == 0
}
};
Their code should be a little more robust against unknown formats :b :
inline texture::texture
(
target_type Target,
format_type Format,
extent_type const& Extent,
size_type Layers,
size_type Faces,
size_type Levels,
swizzles_type const& Swizzles
)
: Storage(std::make_shared<storage_type>(Format, Extent, Layers, Faces, Levels)) <--- fails here, Format = FORMAT_UNDEFINED (0)
from imageviewer.
Thanks for the information!
Is it correct that just some arbitrary test files do not work due to gli?
If you have troubles opening actual files you need to work with I can also try to fix the error on my forked gli branch first. I know that it can take a few years for them to fix issues or even accept pull requests.
from imageviewer.
Is it correct that just some arbitrary test files do not work due to gli?
Yep, the files I tried are arbitrary as I just randomly downloaded a few .ktx's from the Khronos Group repo (but they're AFAIK not particularly novel or anything).
it can take a few years for them to fix issues or even accept pull requests
Oh wow, a few years. Well I don't need a fix, because I found this converter online (https://comparecommander.com/convert-ktx-to-png/), but I wanted to report the issue either way. I stumbled across your viewer last night while looking for a way to display .ktx files because I've been collecting a large list of pixel formats from various API and file format specifications (DXGI, D3D, WIC, Vulkan, OpenGL, PVR, GenICam PFNC...). Thanks.
from imageviewer.
Related Issues (20)
- Operator precedence invalid
- Exporting with a view multiplyer (example 1/2) is falsely applied to the alpha chanel
- Add Ctrl+O for opening files
- Invalid Formula (I0-I1)^2 HOT 1
- KTX Cubemap export HOT 2
- Port to macOS or Linux HOT 1
- PFM image with not-a-one scale is not displayed properly. HOT 3
- 3.5 download zip is tagged with a virus HOT 1
- Why astc and etc2 looks different from orginal png? HOT 6
- Add shortcut to turn off/on alpha channel and shortcut to show Alpha channel only. HOT 2
- when I read hdr I got a error [error during reading file ] HOT 7
- Hope to support horizontal or vertical CUbeMap conversion of latitude and longitude HOT 1
- malware included? im unsure... HOT 1
- ImageConsole.exe using float as a filterparam HOT 1
- 8K Cubemap HOT 4
- Channel Selector / Separator Dropdown HOT 13
- Crashes on loading sample KTX file HOT 7
- The type initializer for 'ImageFramework.DirectX.Device' threw an exception HOT 1
- Add the ability to change the color space of the image and save it with the applied parameter HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from imageviewer.