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

RGBA128 texture is silently changed to R8_UNORM on d3d11 #1345

Closed
MoritzBrueckner opened this issue May 31, 2021 · 1 comment
Closed

RGBA128 texture is silently changed to R8_UNORM on d3d11 #1345

MoritzBrueckner opened this issue May 31, 2021 · 1 comment
Labels

Comments

@MoritzBrueckner
Copy link
Contributor

Describe the bug
When passing an RGBA128 texture to a shader on windows-hl/d3d11, the texture format seems to get silently changed to R8_UNORM according to both RenderDoc and Intel GPA. This creates unexpected results in the shader.

I noticed that there are some places in the Kinc code where the usage of formats seemingly gets restricted (like here), however I'm not sure if the linked code is actually run in my case. Because of that, Kode/Kinc#623 might be a related issue. I'm not sure if it is possible at all to use RGBA128 textures on all targets, but if not this is something that needs to be documented somewhere.

To Reproduce

  1. Create an RGBA128 texture:
    tex = Image.create(256, 256, TextureFormat.RGBA128);
    texData = tex.lock();
    // Write something...
    tex.unlock();
  2. Pass the texture to a shader:
    g4.setTexture(textureUnit, tex);
    // ...
    g4.drawIndexedVertices(...);
  3. Build for windows-hl with d3d11 and compile the project in Visual Studio.
  4. Open the project in a graphics debugger and inspect the texture, the format is now R8_UNORM.

Expected behavior
The texture format should be DXGI_FORMAT_R32G32B32A32_FLOAT instead of DXGI_FORMAT_R8_UNORM so that you can directly sample vec4 values in the shader.

Screenshots
RenderDoc screenshot

Execution Environment:

  • Host system (where you compile your code): Windows 10
  • Target system (where you run your code): Windows 10
  • IDE used (if any): VSCodium/Visual Studio
  • Kha revision: ad815d6, all submodules are checked out to the specified versions.
@RobDangerous RobDangerous added the HL label Nov 8, 2021
@RobDangerous
Copy link
Member

This was purely an HL problem and wasn't related to any actual graphics implementation things.
The HL backend isn't really actively maintained (I don't use it myself), would be great if somebody could jump in.

sh-dave pushed a commit to sh-dave/Kha that referenced this issue Jan 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants