mirror of
https://github.com/bevyengine/bevy
synced 2024-11-25 14:10:19 +00:00
6b073ee412
# Objective Add texture sampling to the GLSL shader example, as naga does not support the commonly used sampler2d type. Fixes #5059 ## Solution - Align the shader_material_glsl example behaviour with the shader_material example, as the later includes texture sampling. - Update the GLSL shader to do texture sampling the way naga supports it, and document the way naga does not support it. ## Changelog - The shader_material_glsl example has been updated to demonstrate texture sampling using the GLSL shading language. Co-authored-by: Carter Anderson <mcanders1@gmail.com>
16 lines
418 B
GLSL
16 lines
418 B
GLSL
#version 450
|
|
layout(location = 0) in vec2 v_Uv;
|
|
|
|
layout(location = 0) out vec4 o_Target;
|
|
|
|
layout(set = 1, binding = 0) uniform CustomMaterial {
|
|
vec4 Color;
|
|
};
|
|
|
|
layout(set = 1, binding = 1) uniform texture2D CustomMaterial_texture;
|
|
layout(set = 1, binding = 2) uniform sampler CustomMaterial_sampler;
|
|
|
|
|
|
void main() {
|
|
o_Target = Color * texture(sampler2D(CustomMaterial_texture,CustomMaterial_sampler), v_Uv);
|
|
}
|