Overlay: Port 2D image overlay shaders to use shaderCreateInfo
This should have no functional changes.
This commit is contained in:
@@ -727,8 +727,8 @@ GPUShader *OVERLAY_shader_edit_uv_stencil_image(void)
|
||||
{
|
||||
OVERLAY_Shaders *sh_data = &e_data.sh_data[0];
|
||||
if (!sh_data->edit_uv_stencil_image) {
|
||||
sh_data->edit_uv_stencil_image = DRW_shader_create_with_shaderlib(
|
||||
datatoc_edit_uv_image_vert_glsl, NULL, datatoc_image_frag_glsl, e_data.lib, NULL);
|
||||
sh_data->edit_uv_stencil_image = GPU_shader_create_from_info_name(
|
||||
"overlay_edit_uv_stencil_image");
|
||||
}
|
||||
return sh_data->edit_uv_stencil_image;
|
||||
}
|
||||
@@ -737,12 +737,7 @@ GPUShader *OVERLAY_shader_edit_uv_mask_image(void)
|
||||
{
|
||||
OVERLAY_Shaders *sh_data = &e_data.sh_data[0];
|
||||
if (!sh_data->edit_uv_mask_image) {
|
||||
sh_data->edit_uv_mask_image = DRW_shader_create_with_shaderlib(
|
||||
datatoc_edit_uv_image_vert_glsl,
|
||||
NULL,
|
||||
datatoc_edit_uv_image_mask_frag_glsl,
|
||||
e_data.lib,
|
||||
NULL);
|
||||
sh_data->edit_uv_mask_image = GPU_shader_create_from_info_name("overlay_edit_uv_mask_image");
|
||||
}
|
||||
return sh_data->edit_uv_mask_image;
|
||||
}
|
||||
|
@@ -1,11 +1,5 @@
|
||||
#pragma BLENDER_REQUIRE(common_colormanagement_lib.glsl)
|
||||
|
||||
uniform sampler2D imgTexture;
|
||||
uniform vec4 color;
|
||||
|
||||
in vec2 uvs;
|
||||
out vec4 fragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 uvs_clamped = clamp(uvs, 0.0, 1.0);
|
||||
|
@@ -1,8 +1,5 @@
|
||||
#pragma BLENDER_REQUIRE(common_view_lib.glsl)
|
||||
|
||||
in vec3 pos;
|
||||
out vec2 uvs;
|
||||
|
||||
void main()
|
||||
{
|
||||
/* `pos` contains the coordinates of a quad (-1..1). but we need the coordinates of an image
|
||||
|
@@ -1,14 +1,5 @@
|
||||
#pragma BLENDER_REQUIRE(common_colormanagement_lib.glsl)
|
||||
|
||||
uniform sampler2D imgTexture;
|
||||
uniform bool imgPremultiplied;
|
||||
uniform bool imgAlphaBlend;
|
||||
uniform vec4 color;
|
||||
|
||||
in vec2 uvs;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 uvs_clamped = clamp(uvs, 0.0, 1.0);
|
||||
|
@@ -260,6 +260,32 @@ GPU_SHADER_CREATE_INFO(overlay_edit_uv_tiled_image_borders)
|
||||
.fragment_source("gpu_shader_uniform_color_frag.glsl")
|
||||
.additional_info("draw_mesh");
|
||||
|
||||
GPU_SHADER_INTERFACE_INFO(edit_uv_image_iface, "").smooth(Type::VEC2, "uvs");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(overlay_edit_uv_stencil_image)
|
||||
.do_static_compilation(true)
|
||||
.vertex_in(0, Type::VEC3, "pos")
|
||||
.vertex_out(edit_uv_image_iface)
|
||||
.vertex_source("edit_uv_image_vert.glsl")
|
||||
.sampler(0, ImageType::FLOAT_2D, "imgTexture")
|
||||
.push_constant(Type::BOOL, "imgPremultiplied")
|
||||
.push_constant(Type::BOOL, "imgAlphaBlend")
|
||||
.push_constant(Type::VEC4, "color")
|
||||
.fragment_out(0, Type::VEC4, "fragColor")
|
||||
.fragment_source("image_frag.glsl")
|
||||
.additional_info("draw_mesh");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(overlay_edit_uv_mask_image)
|
||||
.do_static_compilation(true)
|
||||
.vertex_in(0, Type::VEC3, "pos")
|
||||
.vertex_out(edit_uv_image_iface)
|
||||
.sampler(0, ImageType::FLOAT_2D, "imgTexture")
|
||||
.push_constant(Type::VEC4, "color")
|
||||
.fragment_out(0, Type::VEC4, "fragColor")
|
||||
.vertex_source("edit_uv_image_vert.glsl")
|
||||
.fragment_source("edit_uv_image_mask_frag.glsl")
|
||||
.additional_info("draw_mesh");
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
Reference in New Issue
Block a user