Commit 75822e2
authored
ReleasedDynamicTexture: Fix default nearest min/mag filter not being applied on 1.21.5+
The 1.21.5 `setTextureFilter` method doesn't actually apply the filter
to the OpenGL object, it merely stores the desired values inside the
`GpuTexture` object which are then applied lazily in
`GlCommandEncoder.setupRenderPass`.
This however necessitates that the same `GpuTexture` object that was
created here is also passed to the render pass, and since a lot of
UniversalCraft-using code simply passes around raw OpenGL IDs, this
isn't often the case (in fact, our URenderPass doesn't even support
accepting MC's `GpuTexture` type).
A proper solution would be to introduce a universal `GpuTexture` type
and to deprecate all the old raw OpenGL ID APIs. This however introduces
a lot of new API surface, so I'd want to get it right, and I'm not yet
confident enough in having a good picture of how this new API should
look.
This commit fixes the issue by eagerly applying the filter during
construction, matching the behavior of older MC versions.
Another alternate solution I had considered was to internally pass
around the `GpuTexture` objects via a global weak Map which maps OpenGL
IDs to ReleasedDynamicTexture objects. However, this would break
existing users which re-configure the filter mode via raw OpenGL before
rendering, since any such modification would then be lost when MC
applies the filters configured on the `GpuTexture` object.
Linear: EM-3194
GitHub: #1131 parent 4fd7050 commit 75822e2
File tree
1 file changed
+7
-0
lines changed- src/main/kotlin/gg/essential/universal/utils
1 file changed
+7
-0
lines changedLines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
130 | 137 | | |
131 | 138 | | |
132 | 139 | | |
| |||
0 commit comments