GPU: Create Info for GPU_SHADER_2D_IMAGE_MULTI_RECT_COLOR.
This patch converts GPU_SHADER_2D_IMAGE_MULTI_RECT_COLOR shader to use the GPUShaderCreateInfo pattern. It can be used as a reference when converting other shaders. In this special case the flat uniform vector cannot be used anymore as it doesn't fit as push constants. To solve this a uniform buffer is used.
This commit is contained in:
@@ -17,9 +17,9 @@ in vec2 pos;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 rect = calls_data[gl_InstanceID * 3];
|
||||
vec4 tex = calls_data[gl_InstanceID * 3 + 1];
|
||||
finalColor = calls_data[gl_InstanceID * 3 + 2];
|
||||
vec4 rect = multi_rect_data.calls_data[gl_InstanceID * 3];
|
||||
vec4 tex = multi_rect_data.calls_data[gl_InstanceID * 3 + 1];
|
||||
finalColor = multi_rect_data.calls_data[gl_InstanceID * 3 + 2];
|
||||
|
||||
/* Use pos to select the right swizzle (instead of gl_VertexID)
|
||||
* in order to workaround an OSX driver bug. */
|
||||
|
||||
@@ -31,3 +31,6 @@ GPU_SHADER_INTERFACE_INFO(smooth_color_iface, "").smooth(Type::VEC4, "finalColor
|
||||
GPU_SHADER_INTERFACE_INFO(smooth_tex_coord_interp_iface, "").smooth(Type::VEC2, "texCoord_interp");
|
||||
GPU_SHADER_INTERFACE_INFO(smooth_radii_iface, "").smooth(Type::VEC2, "radii");
|
||||
GPU_SHADER_INTERFACE_INFO(smooth_radii_outline_iface, "").smooth(Type::VEC4, "radii");
|
||||
GPU_SHADER_INTERFACE_INFO(flat_color_smooth_tex_coord_interp_iface, "")
|
||||
.flat(Type::VEC4, "finalColor")
|
||||
.smooth(Type::VEC2, "texCoord_interp");
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
#include "gpu_interface_info.hh"
|
||||
#include "gpu_shader_create_info.hh"
|
||||
|
||||
GPU_SHADER_CREATE_INFO(gpu_shader_2D_image_multi_rect_color)
|
||||
.vertex_in(0, Type::VEC2, "pos")
|
||||
.vertex_out(flat_color_smooth_tex_coord_interp_iface)
|
||||
.fragment_out(0, Type::VEC4, "fragColor")
|
||||
.uniform_buf(0, "MultiRectCallData", "multi_rect_data")
|
||||
.sampler(0, ImageType::FLOAT_2D, "image")
|
||||
.typedef_source("GPU_shader_shared.h")
|
||||
.vertex_source("gpu_shader_2D_image_multi_rect_vert.glsl")
|
||||
.fragment_source("gpu_shader_image_varying_color_frag.glsl")
|
||||
.do_static_compilation(true);
|
||||
Reference in New Issue
Block a user