LLGL 0.05 Beta
Loading...
Searching...
No Matches
LLGL::CombinedTextureSamplerDescriptor Struct Reference

Descriptor structure for a combined texture-sampler. More...

#include <PipelineLayoutFlags.h>

Public Attributes

StringLiteral name
 Specifies the name of an individual shader uniform. This must not be empty.
StringLiteral textureName
 Specifies the name of the texture binding that is meant to be combined with a sampler binding.
StringLiteral samplerName
 Specifies the name of the sampler binding that is meant to be combined with a texture binding.
BindingSlot slot
 Specifies the binding slot of the combined texture-sampler.

Detailed Description

Descriptor structure for a combined texture-sampler.

Remarks
Combined texture-samplers are only required for OpenGL when a sampler is meant to be used for more than one texture in a shader. The following example of an HLSL (Direct3D) shader illustrates how these descriptors are meant to be used:
SamplerState linearSampler;
SamplerState nearestSampler;
Texture2D colorMapA;
Texture2D colorMapB;
Texture2D colorMapC;
float4 PSMain(float2 tc : TEXCOORD) : SV_Target {
// Use each sampler with two textures
return
colorMapA.Sample(linearSampler, tc) + // Tex A with Sampler A
colorMapB.Sample(linearSampler, tc) + // Tex B with Sampler A
colorMapB.Sample(nearestSampler, tc) + // Tex B with Sampler B
colorMapC.Sample(nearestSampler, tc); // Tex C with Sampler B
}
This could be translated to GLSL as follows:
#version 330
uniform sampler2D colorMapA_linearSampler;
uniform sampler2D colorMapB_linearSampler;
uniform sampler2D colorMapB_nearestSampler;
uniform sampler2D colorMapC_nearestSampler;
in vec2 tc;
out vec4 fragColor;
void main() {
fragColor =
texture(colorMapA_linearSampler, tc) +
texture(colorMapB_linearSampler, tc) +
texture(colorMapB_nearestSampler, tc) +
texture(colorMapC_nearestSampler, tc);
}
For GLSL, this requires four combined texture-sampler descriptors:
myPSOLayout.bindings = {
LLGL::BindingDescriptor{ "colorMapB", LLGL::ResourceType::Texture, ... },
LLGL::BindingDescriptor{ "colorMapC", LLGL::ResourceType::Texture, ... },
};
myPSOLayout.combinedTextureSampler = {
LLGL::CombinedTextureSamplerDescriptor{ "colorMapA_linearSampler", "colorMapA", "linearSampler", 1 },
LLGL::CombinedTextureSamplerDescriptor{ "colorMapB_linearSampler", "colorMapB", "linearSampler", 2 },
LLGL::CombinedTextureSamplerDescriptor{ "colorMapB_nearestSampler", "colorMapB", "nearestSampler", 3 },
LLGL::CombinedTextureSamplerDescriptor{ "colorMapC_nearestSampler", "colorMapC", "nearestSampler", 4 },
};
@ Sampler
Sampler state resource.
Definition ResourceFlags.h:49
@ Texture
Texture resource.
Definition ResourceFlags.h:42
Layout structure for a single binding point of the pipeline layout descriptor.
Definition PipelineLayoutFlags.h:175
Pipeline layout descriptor structure.
Definition PipelineLayoutFlags.h:477
std::vector< BindingDescriptor > bindings
List of individual layout resource bindings.
Definition PipelineLayoutFlags.h:502
Note
Only supported with: OpenGL, Vulkan.
See also
PipelineLayoutDescriptor::combinedTextureSamplers

Member Data Documentation

◆ name

StringLiteral LLGL::CombinedTextureSamplerDescriptor::name

Specifies the name of an individual shader uniform. This must not be empty.

Remarks
This is the name of the combined texture-sampler in the shader, e.g. "myTex" for uniform sampler2D myTex; in GLSL.

◆ samplerName

StringLiteral LLGL::CombinedTextureSamplerDescriptor::samplerName

Specifies the name of the sampler binding that is meant to be combined with a texture binding.

Remarks
This can refer to either an entry in heapBindings, bindings, or staticSamplers of PipelineLayoutDescriptor.
See also
BindingDescriptor::name

◆ slot

BindingSlot LLGL::CombinedTextureSamplerDescriptor::slot

Specifies the binding slot of the combined texture-sampler.

Remarks
This overrides the binding slot for both the texture and sampler binding that this combined texture-sampler refers to. The binding and stage flags are each a bitwise OR combination of the texture and sampler respectively.

◆ textureName

StringLiteral LLGL::CombinedTextureSamplerDescriptor::textureName

Specifies the name of the texture binding that is meant to be combined with a sampler binding.

Remarks
This can refer to either an entry in heapBindings or bindings of PipelineLayoutDescriptor.
See also
BindingDescriptor::name

The documentation for this struct was generated from the following file: