Crafter.Graphics/interfaces/Crafter.Graphics.cppm
Jorijn van der Graaf 594e1612f7
fix(device): stop requiring samplerAnisotropy, and remove SamplerVulkan, the class it was required for
Device::Initialize counted samplerAnisotropy among the library's own
features because SamplerVulkan turned anisotropic filtering on (#168).
Nothing in this repository has made a SamplerVulkan since 6e94cc6,
which replaced Sponza's with a sampler-heap write. So Initialize
enabled the feature for every application where the GPU had it, and
skipped a GPU without it, for a class this repository no longer used.
Design rule 8 has the library enable only the device features its own
shaders use.

SamplerVulkan: removed. #168's other suggestion keeps it, with
deferred deletion, a clamp to maxSamplerAnisotropy and anisotropy left
to the application. But the VkSampler it makes has no way into the
heap, which takes a sampler's create-info rather than a sampler
object: vkWriteSamplerDescriptorsEXT writes the descriptor straight
from the VkSamplerCreateInfo. In descriptor-set mode the heap makes
each slot's VkSampler itself, in DescriptorHeapVulkan::WriteSamplerSets,
from the same create-info. A class that fitted the heap would hold a
SamplerSlot and that write; a one-call sampler write for code without
a UIRenderer is #177's, which asks for heap-mode writers on
DescriptorHeapVulkan for images, buffers and samplers alike. The
partition leaves project.cpp's ifaces and the umbrella module.

Device: samplerAnisotropy leaves the library's features. No sampler
the library, its tests or its examples make sets anisotropyEnable. An
application that wants anisotropic filtering asks Device::Initialize
for the feature.

Docs: AGENTS.template.md counts 40 partitions and no longer lists
:SamplerVulkan. AGENTS.consumer.md describes samplers as slots written
from a create-info: through UIRenderer::RegisterSampler, or, without a
UIRenderer, through vkWriteSamplerDescriptorsEXT as Sponza does, or
WriteSamplerSets in descriptor-set mode. It says that anisotropyEnable
needs .vulkan10.samplerAnisotropy from the application. The README
names samplerAnisotropy among the features an application asks for.

Tests: FeatureRequests checks, in its main run and in its Vulkan 1.3
child (CRAFTER_GRAPHICS_NO_VULKAN_1_4), that samplerAnisotropy is off
after a Device::Initialize that does not ask for it. With the
requirement put back, the check fails in both, on the RTX 4090 here,
which has the feature.
2026-11-26 09:37:44 +01:00

58 lines
1.8 KiB
C++

//SPDX-License-Identifier: LGPL-3.0-only
//SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
export module Crafter.Graphics;
// Every partition is `export import`'d unconditionally. Crafter.Build's
// dependency scanner doesn't respect `#ifdef` on `import :X`, so the
// partition file must always exist. Vulkan-typed partitions stub to
// empty modules under CRAFTER_GRAPHICS_WINDOW_DOM, and the new Dom /
// DomEvents / Router partitions stub to empty modules in native
// builds — see project.cpp for the master list.
export import :Types;
export import :Keys;
export import :Gamepad;
export import :Window;
export import :Input;
export import :Device;
export import :Animation;
export import :ForwardDeclarations;
export import :GraphicsTypes;
export import :Clipboard;
// Vulkan-backed partitions — empty under DOM.
export import :Font;
export import :Mesh;
export import :VulkanTransition;
export import :VulkanBuffer;
export import :ShaderVulkan;
export import :ShaderBindingTableVulkan;
export import :PipelineRTVulkan;
export import :RenderingElement3D;
export import :ImageVulkan;
export import :Image2D;
export import :DescriptorHeapVulkan;
export import :RenderPass;
export import :RTPass;
export import :FontAtlas;
export import :ComputeShader;
export import :UI;
export import :UIComponents;
export import :InputField;
export import :Decompress;
// Portable RT type aliases (provided on both targets — uses Vulkan
// structs natively, plain PODs of the same layout on DOM).
export import :RT;
// DOM-only partitions — empty under native.
export import :Dom;
export import :DomEvents;
export import :Router;
export import :WebGPU;
export import :WebGPUBuffer;
export import :DescriptorHeapWebGPU;
export import :WebGPUComputeShader;
export import :PlainComputeShader;
export import :ShaderBindingTableWebGPU;
export import :PipelineRTWebGPU;