baldurk / renderdoc

RenderDoc is a stand-alone graphics debugging tool.
https://renderdoc.org
MIT License
8.88k stars 1.33k forks source link

OpenGL: Wrong zoom level with texture generated via glTextureView() #3279

Closed Froyok closed 6 months ago

Froyok commented 6 months ago

Description

In my RenderDoc captures of my OpenGL program, several textures represented via a TextureView result in an incorrect zoom level when using the Texture Viewer. The "1:1" and "Fit" don't produce the correct zoom level. The nearest/bilinear filter also seems to trigger incorrectly.

For example, with a texture of 15x8 pixels it will fill the window when using the 1:1 button and the Fit button will result in extreme zoom levels (like >6000%). This doesn't happen with texture created in other ways.

I would expect the zoom levels and buttons to behave like it would with other textures/render targets.


Example of a 40x22 texture in "fit" mode: zoom_fit_mode

Example of a 40x22 pixels texture in "1:1" mode: zoom_1-1_mode


To give some context on what is done in the background: those texture views are actually different mip levels of the same source texture. I do that to be able to downsample from one mip into another smaller one using a custom shader rather than using a traditional bilinear filter.

Steps to reproduce

  1. Download the following capture: rdc_bug_report_textureviews_zoom.zip
  2. Open the Event Browser window
  3. Expand to: a. Frame b. Draw view c. Post-Process d. Fog blur e. Blur downsample f. Downsample 6 g. glDrawArrays()
  4. Use the Fit or 1:1 buttons in the TextureViewer on the Inputs or Outputs texture.

(I hope this is enough, I tried to make the capture as lightweight as possible.)

Environment

Zorro666 commented 6 months ago

Thank you for such a clear reproduction case. Other places were incorrect i.e. saving the texture contents. The issue was glTextureView with non-zero minlevel.