Skip to content

Ability to merge group of constants #48

Description

@Lulu13022002

This is more a feature request than a bug but having the possibility to merge two set of constants would simplify a bit some usage.
For example given the following generic method:

public static boolean hasAnyBit(final int bitfield, final int bitmask) {
    return (bitfield & bitmask) != 0;
}

In the source bitmask might take multiple type of flags currently this require to manually collapse all the constants under the same group like so:

unpick v4

group int vk_any_bitmask
	@flags # gpu_buffer_usage
	@scope class com.mojang.blaze3d.vulkan.VulkanGpuBuffer
	com.mojang.blaze3d.buffers.GpuBuffer.USAGE_MAP_READ
	com.mojang.blaze3d.buffers.GpuBuffer.USAGE_MAP_WRITE
	com.mojang.blaze3d.buffers.GpuBuffer.USAGE_HINT_CLIENT_STORAGE
	com.mojang.blaze3d.buffers.GpuBuffer.USAGE_COPY_DST
	com.mojang.blaze3d.buffers.GpuBuffer.USAGE_COPY_SRC
	com.mojang.blaze3d.buffers.GpuBuffer.USAGE_VERTEX
	com.mojang.blaze3d.buffers.GpuBuffer.USAGE_INDEX
	com.mojang.blaze3d.buffers.GpuBuffer.USAGE_UNIFORM
	com.mojang.blaze3d.buffers.GpuBuffer.USAGE_UNIFORM_TEXEL_BUFFER

group int vk_any_bitmask
	@flags # gpu_texture_usage
	@scope class com.mojang.blaze3d.vulkan.VulkanGpuTexture
	com.mojang.blaze3d.textures.GpuTexture.USAGE_COPY_DST
	com.mojang.blaze3d.textures.GpuTexture.USAGE_COPY_SRC
	com.mojang.blaze3d.textures.GpuTexture.USAGE_TEXTURE_BINDING
	com.mojang.blaze3d.textures.GpuTexture.USAGE_RENDER_ATTACHMENT
	com.mojang.blaze3d.textures.GpuTexture.USAGE_CUBEMAP_COMPATIBLE

It would be more convenient to instead define the two sets of constants separatly and in a third group just merge the two other group:

group int gpu_buffer_usage
	@flags
	com.mojang.blaze3d.buffers.GpuBuffer.USAGE_MAP_READ
	com.mojang.blaze3d.buffers.GpuBuffer.USAGE_MAP_WRITE
	com.mojang.blaze3d.buffers.GpuBuffer.USAGE_HINT_CLIENT_STORAGE
	com.mojang.blaze3d.buffers.GpuBuffer.USAGE_COPY_DST
	com.mojang.blaze3d.buffers.GpuBuffer.USAGE_COPY_SRC
	com.mojang.blaze3d.buffers.GpuBuffer.USAGE_VERTEX
	com.mojang.blaze3d.buffers.GpuBuffer.USAGE_INDEX
	com.mojang.blaze3d.buffers.GpuBuffer.USAGE_UNIFORM
	com.mojang.blaze3d.buffers.GpuBuffer.USAGE_UNIFORM_TEXEL_BUFFER

group int gpu_texture_usage
	@flags
	com.mojang.blaze3d.textures.GpuTexture.USAGE_COPY_DST
	com.mojang.blaze3d.textures.GpuTexture.USAGE_COPY_SRC
	com.mojang.blaze3d.textures.GpuTexture.USAGE_TEXTURE_BINDING
	com.mojang.blaze3d.textures.GpuTexture.USAGE_RENDER_ATTACHMENT
	com.mojang.blaze3d.textures.GpuTexture.USAGE_CUBEMAP_COMPATIBLE

group int vk_any_bitmask
	@scope class com.mojang.blaze3d.vulkan.VulkanGpuBuffer
 	@from gpu_buffer_usage

group int vk_any_bitmask
	@scope class com.mojang.blaze3d.vulkan.VulkanGpuTexture
 	@from gpu_texture_usage

That way there is no need to duplicate gpu_texture_usage and gpu_buffer_usage constants twice.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions