Skip to content

Conversation

@Johni0702
Copy link
Collaborator

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

…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
@Johni0702 Johni0702 requested a review from DJtheRedstoner July 16, 2025 07:31
@linear
Copy link

linear bot commented Jul 16, 2025

Copy link
Contributor

@Traben-0 Traben-0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@Johni0702 Johni0702 merged commit 75822e2 into master Aug 1, 2025
1 check passed
@Johni0702 Johni0702 deleted the feature/em-3194-use-minecraft-button-texture-blurry-on-1215 branch August 1, 2025 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants