sp614x / optifine

1.8k stars 418 forks source link

Mipmap Generation Shader Programs #2079

Open zombye opened 5 years ago

zombye commented 5 years ago

It would be useful to have an extra set of programs that can define how mipmaps are generated just before/after each program. I'm not entirely sure how exactly this should work and also not sure how things should be named, but generating mipmaps with custom shader programs would be quite beneficial for me (and probably other shaderpack developers as well). The main purpose of this would be to allow for correct mipmapping when any sort of special encoding is used for the data that is stored in the buffers.

These would probably have the names of the existing programs but with the name suffixed with _mipmap, each running just before/after the program it gets its name from - I'm fine with either order. It should be possible to have one between every composite and deferred program, and one before and after each of those groups.

Each of these programs would run multiple times, once for each mip level, and the mip level would be provided with a define (or a uniform int, in case that would be better), and they would run regardless of what the colortexNMipmapEnabled options are set to, and if they are not present mipmap generation would simply function as it does currently.

These programs would have access to all the same uniforms as the current composite & deferred programs, meaning they could read from any buffer at any mip level - this would be useful in some cases. They would also have something similar to the DRAWBUFFERS: comment of deferred & composite to define the buffers it's generating mipmaps for.

JadeMonsuta commented 5 years ago

Or an option to specifically define the mipmap textures