Repository navigation
GPU tier: texture formats and anisotropic filtering (#2397) - #2403
Merged
Merged
Conversation
texture_create_format makes a 2D texture in R8, RG8, RGBA8 UNORM or sRGB, RGBA16F, RGBA32F, or the BC1, BC3, BC4, BC5 and BC7 block formats, in contrib.vulkan, contrib.d3d12 and contrib.metal; texture_format_supported asks first. A mipmapped uncompressed texture builds its chain in its own format (D3D12 on the CPU, sRGB averaged as light); texture_upload_level uploads a block format's chain level by level, and the texture binds once every level has pixels. Anisotropy is granted up to the device's limit and reported by texture_anisotropy. Each module's textures spec samples every uncompressed format, checks each chain's last level, decodes known BC1, BC4 and BC7 blocks, uploads a BC1 chain by level, and shows squeezed stripes staying sharp only when filtered anisotropically.
Newer lavapipe keeps about a fifth of the stripes' contrast through its anisotropic approximation, which the API leaves to the implementation. The spec now asks for an isotropic sampler to blur the stripes to grey and an anisotropic one to keep clearly more, and prints both.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2397.
Masks, normal maps, HDR images and compressed assets can now be sampled through the shared GPU shape, in contrib.vulkan, contrib.d3d12 and contrib.metal.
texture_create_format(dev, w, h, format, mipmapped, linear, repeat, anisotropy)makes a 2D texture in R8, RG8, RGBA8 UNORM or sRGB, RGBA16F, RGBA32F, or BC1/BC3/BC4/BC5/BC7 (BC1, BC3 and BC7 also sRGB).texture_format_supportedasks first. A block-compressed texture must be whole 4x4 blocks in every module, because Direct3D 12 requires it.generateMipmapsForTexture:, and refuses a 32-bit float chain where the GPU cannot filter one.texture_upload_leveluploads a block format's chain, or one made offline, one level at a time. Only that level's layout or state changes. The texture binds once every level has pixels, and the refusal says which case it is.texture_anisotropyreports what was granted.Tests: each module's textures spec checks the following against pixels read back from an RGBA32F target:
Run locally:
Follow-up filed: BC6H, ASTC/ETC2, signed formats, and cubes and arrays in other formats (#2402).