Skip to content

Add support for runtime mipmap generation. #2

@mtwilliams

Description

@mtwilliams

Runtime mipmap generation should be exposed for texture objects.

The cleanest approach would be to provide a stateless method that explicitly generates mipmaps from the top-most level, i.e., agl_texture_generate_mipmaps(). However, this violates the zero-copy design philosophy of AGL, and is impossible for immutable texture objects. Thus, agl_texture_data_1d/2d/3d() should accept flags, of which AUTO_GENERATE_MIPMAPS should implement the desired behavior.

agl_texture_data_2d(texture, x, y, w, h, format, data, AGL_TEXTURE_AUTO_GENERATE_MIPMAPS);
((agl::Texture2D *)texture)->data(x, y, w, h, format, data, agl::Texture::AutoGenerateMipmaps);

Alternatively, a boolean texture parameter can be exposed that results in similar behavior:

agl_texture_set_parameter_boolean(texture, AGL_TEXTURE_PARAMETER_AUTO_GENERATE_MIPMAPS, 1);
agl_texture_data_2d(texture, x, y, w, h, format, data);
texture->set_parameter(agl::Texture::Parameters::AutoGenerateMipmaps, true);
((agl::Texture2D *)texture)->data(x, y, w, h, format, data);

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions