Search across packages, versions, files, declarations, and comments. Use multiple terms to narrow results (AND), and add @vertex, @fragment, or @compute to filter by shader stage.

Bindings

material_indices

#
@group(constants::MATERIAL_BIND_GROUP)
@binding(0)
var<storage> material_indices: array<CustomMaterialBindings>

material_data

#
@group(constants::MATERIAL_BIND_GROUP)
@binding(4)
var<storage> material_data: binding_array<CustomMaterialDataArray>
@group(constants::MATERIAL_BIND_GROUP)
@binding(1)
var<storage> material_data: CustomMaterialDataArray

color_texture

#
@group(constants::MATERIAL_BIND_GROUP)
@binding(2)
var color_texture: texture_2d<f32>

color_texture_sampler

#
@group(constants::MATERIAL_BIND_GROUP)
@binding(3)
var color_texture_sampler: sampler

Structures

CustomMaterialData

#

The custom data that we extract from the ECS and expose to this shader.

struct CustomMaterialData {
color: vec3<f32> ,
pad: u32 ,
}

CustomMaterialDataArray

#

We need to declare this type because binding_array<array<CustomMaterialData>> isn’t currently accepted by Naga. We have to factor the array<CustomMaterialData> out into a separate type.

struct CustomMaterialDataArray {
data_array: array<CustomMaterialData> ,
}

CustomMaterialBindings

#

These are indexes into the various arrays.

struct CustomMaterialBindings {
material: u32 ,
data: u32 ,
color_texture: u32 ,
color_texture_sampler: u32 ,
}

Functions

fragment

#
@fragment
Calculates the final color of each pixel on the screen
fn fragment (
in: VertexOutput
) ->
@location(0)
vec4<f32>
Contents