GPUShaderCreateInfo: Remove push_constant indexing

This is too much impractical and offers no real benefit.
This commit is contained in:
Clément Foucault 2022-01-27 08:48:37 +01:00
parent a7f7b0b77e
commit 5abab0a41a
41 changed files with 123 additions and 138 deletions

View File

@ -9,7 +9,7 @@ GPU_SHADER_CREATE_INFO(workbench_composite)
.sampler(0, ImageType::FLOAT_2D, "normalBuffer", Frequency::PASS)
.sampler(1, ImageType::FLOAT_2D, "materialBuffer", Frequency::PASS)
.uniform_buf(4, "WorldData", "world_data", Frequency::PASS)
.push_constant(0, Type::BOOL, "forceShadowing")
.push_constant(Type::BOOL, "forceShadowing")
.fragment_out(0, Type::VEC4, "fragColor")
.typedef_source("workbench_shader_shared.h")
.fragment_source("workbench_composite_frag.glsl")

View File

@ -7,7 +7,7 @@
GPU_SHADER_CREATE_INFO(workbench_taa)
.sampler(0, ImageType::FLOAT_2D, "colorBuffer")
.push_constant(0, Type::FLOAT, "samplesWeights", 9)
.push_constant(Type::FLOAT, "samplesWeights", 9)
.fragment_out(0, Type::VEC4, "fragColor")
.fragment_source("workbench_effect_taa_frag.glsl")
.additional_info("draw_fullscreen")
@ -31,7 +31,7 @@ GPU_SHADER_CREATE_INFO(workbench_smaa)
.define("SMAA_LUMA_WEIGHT", "float4(1.0, 1.0, 1.0, 1.0)")
.define("SMAA_NO_DISCARD")
.vertex_out(workbench_smaa_iface)
.push_constant(1, Type::VEC4, "viewportMetrics")
.push_constant(Type::VEC4, "viewportMetrics")
.vertex_source("workbench_effect_smaa_vert.glsl")
.fragment_source("workbench_effect_smaa_frag.glsl");
@ -55,8 +55,8 @@ GPU_SHADER_CREATE_INFO(workbench_smaa_stage_2)
.define("SMAA_STAGE", "2")
.sampler(0, ImageType::FLOAT_2D, "colorTex")
.sampler(1, ImageType::FLOAT_2D, "blendTex")
.push_constant(2, Type::FLOAT, "mixFactor")
.push_constant(3, Type::FLOAT, "taaAccumulatedWeight")
.push_constant(Type::FLOAT, "mixFactor")
.push_constant(Type::FLOAT, "taaAccumulatedWeight")
.fragment_out(0, Type::VEC4, "out_color")
.additional_info("workbench_smaa")
.do_static_compilation(true);

View File

@ -11,10 +11,10 @@ GPU_SHADER_CREATE_INFO(workbench_effect_dof)
.sampler(5, ImageType::FLOAT_2D, "halfResColorTex")
.sampler(6, ImageType::FLOAT_2D, "blurTex")
.sampler(7, ImageType::FLOAT_2D, "noiseTex")
.push_constant(0, Type::VEC2, "invertedViewportSize")
.push_constant(1, Type::VEC2, "nearFar")
.push_constant(2, Type::VEC3, "dofParams")
.push_constant(3, Type::FLOAT, "noiseOffset")
.push_constant(Type::VEC2, "invertedViewportSize")
.push_constant(Type::VEC2, "nearFar")
.push_constant(Type::VEC3, "dofParams")
.push_constant(Type::FLOAT, "noiseOffset")
.fragment_source("workbench_effect_dof_frag.glsl")
.additional_info("draw_fullscreen")
.additional_info("draw_view");

View File

@ -36,15 +36,15 @@ GPU_SHADER_CREATE_INFO(workbench_texture_none).define("TEXTURE_NONE");
GPU_SHADER_CREATE_INFO(workbench_texture_single)
.sampler(2, ImageType::FLOAT_2D, "imageTexture", Frequency::BATCH)
.push_constant(1, Type::BOOL, "imagePremult")
.push_constant(2, Type::FLOAT, "imageTransparencyCutoff")
.push_constant(Type::BOOL, "imagePremult")
.push_constant(Type::FLOAT, "imageTransparencyCutoff")
.define("V3D_SHADING_TEXTURE_COLOR");
GPU_SHADER_CREATE_INFO(workbench_texture_tile)
.sampler(2, ImageType::FLOAT_2D_ARRAY, "imageTileArray", Frequency::BATCH)
.sampler(3, ImageType::FLOAT_1D_ARRAY, "imageTileData", Frequency::BATCH)
.push_constant(1, Type::BOOL, "imagePremult")
.push_constant(2, Type::FLOAT, "imageTransparencyCutoff")
.push_constant(Type::BOOL, "imagePremult")
.push_constant(Type::FLOAT, "imageTransparencyCutoff")
.define("V3D_SHADING_TEXTURE_COLOR")
.define("TEXTURE_IMAGE_ARRAY");
@ -79,8 +79,8 @@ GPU_SHADER_INTERFACE_INFO(workbench_material_iface, "")
GPU_SHADER_CREATE_INFO(workbench_material)
.uniform_buf(4, "WorldData", "world_data", Frequency::PASS)
.uniform_buf(5, "vec4", "materials_data[4096]", Frequency::PASS)
.push_constant(4, Type::INT, "materialIndex")
.push_constant(5, Type::BOOL, "useMatcap")
.push_constant(Type::INT, "materialIndex")
.push_constant(Type::BOOL, "useMatcap")
.vertex_out(workbench_material_iface);
/** \} */
@ -95,7 +95,7 @@ GPU_SHADER_CREATE_INFO(workbench_transparent_accum)
.fragment_out(0, Type::VEC4, "transparentAccum")
.fragment_out(1, Type::VEC4, "revealageAccum")
.fragment_out(2, Type::UINT, "objectId")
.push_constant(3, Type::BOOL, "forceShadowing")
.push_constant(Type::BOOL, "forceShadowing")
.typedef_source("workbench_shader_shared.h")
.fragment_source("workbench_transparent_accum_frag.glsl");

View File

@ -13,8 +13,8 @@ GPU_SHADER_INTERFACE_INFO(workbench_shadow_iface, "vData")
GPU_SHADER_CREATE_INFO(workbench_shadow_common)
.vertex_in(0, Type::VEC3, "pos")
.vertex_out(workbench_shadow_iface)
.push_constant(0, Type::FLOAT, "lightDistance")
.push_constant(1, Type::VEC3, "lightDirection")
.push_constant(Type::FLOAT, "lightDistance")
.push_constant(Type::VEC3, "lightDirection")
.vertex_source("workbench_shadow_vert.glsl")
.additional_info("draw_mesh");

View File

@ -10,10 +10,10 @@ GPU_SHADER_CREATE_INFO(workbench_volume)
.fragment_out(0, Type::VEC4, "fragColor")
.sampler(0, ImageType::DEPTH_2D, "depthBuffer")
.sampler(1, ImageType::FLOAT_3D, "densityTexture")
.push_constant(28, Type::INT, "samplesLen")
.push_constant(29, Type::FLOAT, "noiseOfs")
.push_constant(30, Type::FLOAT, "stepLength")
.push_constant(31, Type::FLOAT, "densityScale")
.push_constant(Type::INT, "samplesLen")
.push_constant(Type::FLOAT, "noiseOfs")
.push_constant(Type::FLOAT, "stepLength")
.push_constant(Type::FLOAT, "densityScale")
.vertex_source("workbench_volume_vert.glsl")
.fragment_source("workbench_volume_frag.glsl")
.additional_info("draw_object_infos");
@ -32,9 +32,9 @@ GPU_SHADER_CREATE_INFO(workbench_volume_smoke)
GPU_SHADER_CREATE_INFO(workbench_volume_object)
.define("VOLUME_OBJECT")
.push_constant(0, Type::MAT4, "volumeTextureToObject")
.push_constant(Type::MAT4, "volumeTextureToObject")
/* FIXME(fclem): This overflow the push_constant limit. */
.push_constant(16, Type::MAT4, "volumeObjectToTexture")
.push_constant(Type::MAT4, "volumeObjectToTexture")
.additional_info("draw_volume", "draw_resource_id_varying");
/** \} */
@ -47,15 +47,15 @@ GPU_SHADER_CREATE_INFO(workbench_volume_coba)
.define("USE_COBA")
.sampler(4, ImageType::UINT_3D, "flagTexture")
.sampler(5, ImageType::FLOAT_1D, "transferTexture")
.push_constant(18, Type::BOOL, "showPhi")
.push_constant(19, Type::BOOL, "showFlags")
.push_constant(20, Type::BOOL, "showPressure")
.push_constant(21, Type::FLOAT, "gridScale");
.push_constant(Type::BOOL, "showPhi")
.push_constant(Type::BOOL, "showFlags")
.push_constant(Type::BOOL, "showPressure")
.push_constant(Type::FLOAT, "gridScale");
GPU_SHADER_CREATE_INFO(workbench_volume_no_coba)
.sampler(4, ImageType::FLOAT_3D, "shadowTexture")
.sampler(5, ImageType::UINT_2D, "transferTexture")
.push_constant(18, Type::VEC3, "activeColor");
.push_constant(Type::VEC3, "activeColor");
/** \} */
@ -79,8 +79,8 @@ GPU_SHADER_CREATE_INFO(workbench_volume_slice)
.define("VOLUME_SLICE")
.vertex_in(1, Type::VEC3, "uvs")
.vertex_out(workbench_volume_iface)
.push_constant(32, Type::INT, "sliceAxis") /* -1 is no slice. */
.push_constant(33, Type::FLOAT, "slicePosition");
.push_constant(Type::INT, "sliceAxis") /* -1 is no slice. */
.push_constant(Type::FLOAT, "slicePosition");
/** \} */

View File

@ -29,14 +29,14 @@ GPU_SHADER_CREATE_INFO(draw_hair_refine_compute)
.sampler(0, ImageType::FLOAT_BUFFER, "hairPointBuffer")
.sampler(1, ImageType::UINT_BUFFER, "hairStrandBuffer")
.sampler(2, ImageType::UINT_BUFFER, "hairStrandSegBuffer")
.push_constant(0, Type::VEC4, "hairDupliMatrix", 4)
.push_constant(16, Type::BOOL, "hairCloseTip")
.push_constant(17, Type::FLOAT, "hairRadShape")
.push_constant(18, Type::FLOAT, "hairRadTip")
.push_constant(19, Type::FLOAT, "hairRadRoot")
.push_constant(20, Type::INT, "hairThicknessRes")
.push_constant(21, Type::INT, "hairStrandsRes")
.push_constant(22, Type::INT, "hairStrandOffset")
.push_constant(Type::VEC4, "hairDupliMatrix", 4)
.push_constant(Type::BOOL, "hairCloseTip")
.push_constant(Type::FLOAT, "hairRadShape")
.push_constant(Type::FLOAT, "hairRadTip")
.push_constant(Type::FLOAT, "hairRadRoot")
.push_constant(Type::INT, "hairThicknessRes")
.push_constant(Type::INT, "hairStrandsRes")
.push_constant(Type::INT, "hairStrandOffset")
.compute_source("common_hair_refine_comp.glsl")
.define("HAIR_PHASE_SUBDIV")
.do_static_compilation(true);

View File

@ -26,7 +26,7 @@ GPU_SHADER_CREATE_INFO(draw_resource_id_varying)
/* Variation used when drawing multiple instances for one object. */
GPU_SHADER_CREATE_INFO(draw_resource_id_uniform)
.define("UNIFORM_RESOURCE_ID")
.push_constant(64, Type::INT, "drw_ResourceID");
.push_constant(Type::INT, "drw_ResourceID");
/**
* Declare a resource handle that identify a unique object.
@ -34,7 +34,7 @@ GPU_SHADER_CREATE_INFO(draw_resource_id_uniform)
*/
GPU_SHADER_CREATE_INFO(draw_resource_handle)
.define("resource_handle (drw_resourceChunk * DRW_RESOURCE_CHUNK_LEN + resource_id)")
.push_constant(63, Type::INT, "drw_resourceChunk");
.push_constant(Type::INT, "drw_resourceChunk");
/** \} */
@ -54,13 +54,13 @@ GPU_SHADER_CREATE_INFO(draw_modelmat)
GPU_SHADER_CREATE_INFO(draw_modelmat_legacy)
.define("DRW_LEGACY_MODEL_MATRIX")
.push_constant(38, Type::MAT4, "ModelMatrix")
.push_constant(54, Type::MAT4, "ModelMatrixInverse")
.push_constant(Type::MAT4, "ModelMatrix")
.push_constant(Type::MAT4, "ModelMatrixInverse")
.additional_info("draw_view");
GPU_SHADER_CREATE_INFO(draw_modelmat_instanced_attr)
.push_constant(0, Type::MAT4, "ModelMatrix")
.push_constant(16, Type::MAT4, "ModelMatrixInverse")
.push_constant(Type::MAT4, "ModelMatrix")
.push_constant(Type::MAT4, "ModelMatrixInverse")
.additional_info("draw_view");
/** \} */
@ -84,14 +84,14 @@ GPU_SHADER_CREATE_INFO(draw_hair)
.sampler(14, ImageType::UINT_BUFFER, "hairStrandBuffer")
.sampler(13, ImageType::UINT_BUFFER, "hairStrandSegBuffer")
/* TODO(fclem) Pack thoses into one UBO. */
.push_constant(9, Type::INT, "hairStrandsRes")
.push_constant(10, Type::INT, "hairThicknessRes")
.push_constant(11, Type::FLOAT, "hairRadRoot")
.push_constant(12, Type::FLOAT, "hairRadTip")
.push_constant(13, Type::FLOAT, "hairRadShape")
.push_constant(14, Type::BOOL, "hairCloseTip")
.push_constant(15, Type::INT, "hairStrandOffset")
.push_constant(16, Type::VEC4, "hairDupliMatrix", 4)
.push_constant(Type::INT, "hairStrandsRes")
.push_constant(Type::INT, "hairThicknessRes")
.push_constant(Type::FLOAT, "hairRadRoot")
.push_constant(Type::FLOAT, "hairRadTip")
.push_constant(Type::FLOAT, "hairRadShape")
.push_constant(Type::BOOL, "hairCloseTip")
.push_constant(Type::INT, "hairStrandOffset")
.push_constant(Type::VEC4, "hairDupliMatrix", 4)
.additional_info("draw_modelmat", "draw_resource_id");
GPU_SHADER_CREATE_INFO(draw_pointcloud)

View File

@ -314,7 +314,6 @@ struct ShaderCreateInfo {
Vector<StageInterfaceInfo *> geometry_out_interfaces_;
struct PushConst {
int index;
Type type;
StringRefNull name;
int array_size;
@ -503,22 +502,14 @@ struct ShaderCreateInfo {
/** \name Push constants
*
* Data managed by GPUShader. Can be set through uniform functions. Must be less than 128bytes.
* One slot represents 4bytes. Each element needs to have enough empty space left after it.
* example:
* [0] = PUSH_CONSTANT(MAT4, "ModelMatrix"),
* ---- 16 slots occupied by ModelMatrix ----
* [16] = PUSH_CONSTANT(VEC4, "color"),
* ---- 4 slots occupied by color ----
* [20] = PUSH_CONSTANT(BOOL, "srgbToggle"),
* The maximum slot is 31.
* \{ */
Self &push_constant(int slot, Type type, StringRefNull name, int array_size = 0)
Self &push_constant(Type type, StringRefNull name, int array_size = 0)
{
BLI_assert_msg(name.find("[") == -1,
"Array syntax is forbidden for push constants."
"Use the array_size parameter instead.");
push_constants_.append({slot, type, name, array_size});
push_constants_.append({type, name, array_size});
interface_names_size_ += name.size() + 1;
return *(Self *)this;
}

View File

@ -409,9 +409,6 @@ std::string GLShader::resources_declare(const ShaderCreateInfo &info) const
}
ss << "\n/* Push Constants. */\n";
for (const ShaderCreateInfo::PushConst &uniform : info.push_constants_) {
if (GLContext::explicit_location_support) {
ss << "layout(location = " << uniform.index << ") ";
}
ss << "uniform " << to_string(uniform.type) << " " << uniform.name;
if (uniform.array_size > 0) {
ss << "[" << uniform.array_size << "]";

View File

@ -437,10 +437,7 @@ GLShaderInterface::GLShaderInterface(GLuint program, const shader::ShaderCreateI
}
for (const ShaderCreateInfo::PushConst &uni : info.push_constants_) {
copy_input_name(input, uni.name, name_buffer_, name_buffer_offset);
/* Until we make use of explicit uniform location. */
if (true || !GLContext::explicit_location_support) {
input->location = glGetUniformLocation(program, name_buffer_ + input->name_offset);
}
input->location = glGetUniformLocation(program, name_buffer_ + input->name_offset);
input->binding = -1;
input++;
}

View File

@ -29,11 +29,11 @@ GPU_SHADER_CREATE_INFO(gpu_shader_2D_area_borders)
.vertex_in(0, Type::VEC2, "pos")
.vertex_out(smooth_uv_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.push_constant(0, Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(16, Type::VEC4, "rect")
.push_constant(20, Type::VEC4, "color")
.push_constant(24, Type::FLOAT, "scale")
.push_constant(25, Type::INT, "cornerLen")
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(Type::VEC4, "rect")
.push_constant(Type::VEC4, "color")
.push_constant(Type::FLOAT, "scale")
.push_constant(Type::INT, "cornerLen")
.vertex_source("gpu_shader_2D_area_borders_vert.glsl")
.fragment_source("gpu_shader_2D_area_borders_frag.glsl")
.do_static_compilation(true);

View File

@ -26,10 +26,10 @@
GPU_SHADER_CREATE_INFO(gpu_shader_2D_checker)
.vertex_in(0, Type::VEC2, "pos")
.fragment_out(0, Type::VEC4, "fragColor")
.push_constant(0, Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(16, Type::VEC4, "color1")
.push_constant(20, Type::VEC4, "color2")
.push_constant(24, Type::INT, "size")
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(Type::VEC4, "color1")
.push_constant(Type::VEC4, "color2")
.push_constant(Type::INT, "size")
.vertex_source("gpu_shader_2D_vert.glsl")
.fragment_source("gpu_shader_checker_frag.glsl")
.do_static_compilation(true);

View File

@ -26,11 +26,11 @@
GPU_SHADER_CREATE_INFO(gpu_shader_2D_diag_stripes)
.vertex_in(0, Type::VEC2, "pos")
.fragment_out(0, Type::VEC4, "fragColor")
.push_constant(0, Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(16, Type::VEC4, "color1")
.push_constant(20, Type::VEC4, "color2")
.push_constant(24, Type::INT, "size1")
.push_constant(28, Type::INT, "size2")
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(Type::VEC4, "color1")
.push_constant(Type::VEC4, "color2")
.push_constant(Type::INT, "size1")
.push_constant(Type::INT, "size2")
.vertex_source("gpu_shader_2D_vert.glsl")
.fragment_source("gpu_shader_diag_stripes_frag.glsl")
.do_static_compilation(true);

View File

@ -30,7 +30,7 @@ GPU_SHADER_CREATE_INFO(gpu_shader_2D_flat_color)
.vertex_in(1, Type::VEC4, "color")
.vertex_out(flat_color_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.push_constant(0, Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.vertex_source("gpu_shader_2D_flat_color_vert.glsl")
.fragment_source("gpu_shader_flat_color_frag.glsl")
.additional_info("gpu_srgb_to_framebuffer_space")

View File

@ -25,6 +25,6 @@
GPU_SHADER_CREATE_INFO(gpu_shader_2D_image_color)
.additional_info("gpu_shader_2D_image_common")
.push_constant(16, Type::VEC4, "color")
.push_constant(Type::VEC4, "color")
.fragment_source("gpu_shader_image_color_frag.glsl")
.do_static_compilation(true);

View File

@ -25,7 +25,7 @@
GPU_SHADER_CREATE_INFO(gpu_shader_2D_image_desaturate_color)
.additional_info("gpu_shader_2D_image_common")
.push_constant(16, Type::VEC4, "color")
.push_constant(20, Type::FLOAT, "factor")
.push_constant(Type::VEC4, "color")
.push_constant(Type::FLOAT, "factor")
.fragment_source("gpu_shader_image_desaturate_frag.glsl")
.do_static_compilation(true);

View File

@ -29,7 +29,7 @@ GPU_SHADER_CREATE_INFO(gpu_shader_2D_image_common)
.vertex_in(1, Type::VEC2, "texCoord")
.vertex_out(smooth_tex_coord_interp_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.push_constant(0, Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.sampler(0, ImageType::FLOAT_2D, "image")
.vertex_source("gpu_shader_2D_image_vert.glsl");

View File

@ -29,9 +29,9 @@ GPU_SHADER_CREATE_INFO(gpu_shader_2D_image_overlays_merge)
.vertex_in(1, Type::VEC2, "texCoord")
.vertex_out(smooth_tex_coord_interp_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.push_constant(0, Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(16, Type::BOOL, "display_transform")
.push_constant(17, Type::BOOL, "overlay")
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(Type::BOOL, "display_transform")
.push_constant(Type::BOOL, "overlay")
.sampler(0, ImageType::FLOAT_2D, "image_texture")
.sampler(1, ImageType::FLOAT_2D, "overlays_texture")
.vertex_source("gpu_shader_2D_image_vert.glsl")

View File

@ -29,8 +29,8 @@ GPU_SHADER_CREATE_INFO(gpu_shader_2D_image_overlays_stereo_merge)
.fragment_out(1, Type::VEC4, "overlayColor")
.sampler(0, ImageType::FLOAT_2D, "imageTexture")
.sampler(1, ImageType::FLOAT_2D, "overlayTexture")
.push_constant(0, Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(16, Type::INT, "stereoDisplaySettings")
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(Type::INT, "stereoDisplaySettings")
.vertex_source("gpu_shader_2D_vert.glsl")
.fragment_source("gpu_shader_image_overlays_stereo_merge_frag.glsl")
.do_static_compilation(true);

View File

@ -27,10 +27,10 @@
GPU_SHADER_CREATE_INFO(gpu_shader_2D_image_rect_color)
.vertex_out(smooth_tex_coord_interp_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.push_constant(0, Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(16, Type::VEC4, "color")
.push_constant(20, Type::VEC4, "rect_icon")
.push_constant(24, Type::VEC4, "rect_geom")
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(Type::VEC4, "color")
.push_constant(Type::VEC4, "rect_icon")
.push_constant(Type::VEC4, "rect_geom")
.sampler(0, ImageType::FLOAT_2D, "image")
.vertex_source("gpu_shader_2D_image_rect_vert.glsl")
.fragment_source("gpu_shader_image_color_frag.glsl")

View File

@ -25,7 +25,7 @@
GPU_SHADER_CREATE_INFO(gpu_shader_2D_image_shuffle_color)
.additional_info("gpu_shader_2D_image_common")
.push_constant(16, Type::VEC4, "color")
.push_constant(20, Type::VEC4, "shuffle")
.push_constant(Type::VEC4, "color")
.push_constant(Type::VEC4, "shuffle")
.fragment_source("gpu_shader_image_shuffle_color_frag.glsl")
.do_static_compilation(true);

View File

@ -28,7 +28,7 @@
GPU_SHADER_CREATE_INFO(gpu_shader_2D_line_dashed_uniform_color)
.vertex_in(0, Type::VEC3, "pos")
.vertex_out(flat_color_iface)
.push_constant(0, Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.vertex_source("gpu_shader_2D_line_dashed_uniform_color_vert.glsl")
.fragment_source("gpu_shader_2D_line_dashed_frag.glsl")
.do_static_compilation(true);

View File

@ -39,7 +39,7 @@ GPU_SHADER_CREATE_INFO(gpu_shader_2D_nodelink)
.vertex_out(nodelink_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.uniform_buf(0, "NodeLinkData", "node_link_data", Frequency::PASS)
.push_constant(0, Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.vertex_source("gpu_shader_2D_nodelink_vert.glsl")
.fragment_source("gpu_shader_2D_nodelink_frag.glsl")
.typedef_source("GPU_shader_shared.h")
@ -64,7 +64,7 @@ GPU_SHADER_CREATE_INFO(gpu_shader_2D_nodelink_inst)
.vertex_out(nodelink_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.uniform_buf(0, "NodeLinkInstanceData", "node_link_data", Frequency::PASS)
.push_constant(0, Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.vertex_source("gpu_shader_2D_nodelink_vert.glsl")
.fragment_source("gpu_shader_2D_nodelink_frag.glsl")
.typedef_source("GPU_shader_shared.h")

View File

@ -28,9 +28,9 @@ GPU_SHADER_CREATE_INFO(gpu_shader_2D_point_uniform_size_uniform_color_aa)
.vertex_in(0, Type::VEC2, "pos")
.vertex_out(smooth_radii_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.push_constant(0, Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(16, Type::VEC4, "color")
.push_constant(20, Type::FLOAT, "size")
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(Type::VEC4, "color")
.push_constant(Type::FLOAT, "size")
.vertex_source("gpu_shader_2D_point_uniform_size_aa_vert.glsl")
.fragment_source("gpu_shader_point_uniform_color_aa_frag.glsl")
.do_static_compilation(true);

View File

@ -28,11 +28,11 @@ GPU_SHADER_CREATE_INFO(gpu_shader_2D_point_uniform_size_uniform_color_outline_aa
.vertex_in(0, Type::VEC2, "pos")
.vertex_out(smooth_radii_outline_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.push_constant(0, Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(20, Type::VEC4, "color")
.push_constant(24, Type::VEC4, "outlineColor")
.push_constant(28, Type::FLOAT, "size")
.push_constant(29, Type::FLOAT, "outlineWidth")
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(Type::VEC4, "color")
.push_constant(Type::VEC4, "outlineColor")
.push_constant(Type::FLOAT, "size")
.push_constant(Type::FLOAT, "outlineWidth")
.vertex_source("gpu_shader_2D_point_uniform_size_outline_aa_vert.glsl")
.fragment_source("gpu_shader_point_uniform_color_outline_aa_frag.glsl")
.do_static_compilation(true);

View File

@ -30,7 +30,7 @@ GPU_SHADER_CREATE_INFO(gpu_shader_2D_point_varying_size_varying_color)
.vertex_in(2, Type::VEC4, "color")
.vertex_out(smooth_color_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.push_constant(0, Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.vertex_source("gpu_shader_2D_point_varying_size_varying_color_vert.glsl")
.fragment_source("gpu_shader_point_varying_color_frag.glsl")
.do_static_compilation(true);

View File

@ -29,7 +29,7 @@ GPU_SHADER_CREATE_INFO(gpu_shader_2D_smooth_color)
.vertex_in(1, Type::VEC4, "color")
.vertex_out(smooth_color_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.push_constant(0, Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.vertex_source("gpu_shader_2D_smooth_color_vert.glsl")
.fragment_source("gpu_shader_2D_smooth_color_frag.glsl")
.additional_info("gpu_srgb_to_framebuffer_space")

View File

@ -26,8 +26,8 @@
GPU_SHADER_CREATE_INFO(gpu_shader_2D_uniform_color)
.vertex_in(0, Type::VEC2, "pos")
.fragment_out(0, Type::VEC4, "fragColor")
.push_constant(0, Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(16, Type::VEC4, "color")
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(Type::VEC4, "color")
.vertex_source("gpu_shader_2D_vert.glsl")
.fragment_source("gpu_shader_uniform_color_frag.glsl")
.additional_info("gpu_srgb_to_framebuffer_space")

View File

@ -27,7 +27,7 @@
GPU_SHADER_CREATE_INFO(gpu_shader_3D_depth_only)
.vertex_in(0, Type::VEC3, "pos")
.vertex_out(flat_color_iface)
.push_constant(0, Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.vertex_source("gpu_shader_3D_vert.glsl")
.fragment_source("gpu_shader_depth_only_frag.glsl")
.do_static_compilation(true);

View File

@ -29,7 +29,7 @@ GPU_SHADER_CREATE_INFO(gpu_shader_3D_flat_color)
.vertex_in(1, Type::VEC4, "color")
.vertex_out(flat_color_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.push_constant(0, Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.vertex_source("gpu_shader_3D_flat_color_vert.glsl")
.fragment_source("gpu_shader_flat_color_frag.glsl")
.additional_info("gpu_srgb_to_framebuffer_space")

View File

@ -29,8 +29,8 @@ GPU_SHADER_CREATE_INFO(gpu_shader_3D_image_modulate_alpha)
.vertex_in(1, Type::VEC2, "texCoord")
.vertex_out(smooth_tex_coord_interp_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.push_constant(0, Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(16, Type::FLOAT, "alpha")
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(Type::FLOAT, "alpha")
.sampler(0, ImageType::FLOAT_2D, "image", Frequency::PASS)
.vertex_source("gpu_shader_3D_image_vert.glsl")
.fragment_source("gpu_shader_image_modulate_alpha_frag.glsl")

View File

@ -28,7 +28,7 @@
GPU_SHADER_CREATE_INFO(gpu_shader_3D_line_dashed_uniform_color)
.vertex_in(0, Type::VEC3, "pos")
.vertex_out(flat_color_iface)
.push_constant(0, Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.vertex_source("gpu_shader_3D_line_dashed_uniform_color_vert.glsl")
.fragment_source("gpu_shader_2D_line_dashed_frag.glsl")
.do_static_compilation(true);

View File

@ -28,7 +28,7 @@ GPU_SHADER_CREATE_INFO(gpu_shader_3D_point_fixed_size_varying_color)
.vertex_in(1, Type::VEC4, "color")
.vertex_out(smooth_color_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.push_constant(0, Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.vertex_source("gpu_shader_3D_point_fixed_size_varying_color_vert.glsl")
.fragment_source("gpu_shader_point_varying_color_frag.glsl")
.do_static_compilation(true);
@ -39,7 +39,7 @@ GPU_SHADER_CREATE_INFO(gpu_shader_3D_point_varying_size_varying_color)
.vertex_in(2, Type::FLOAT, "size")
.vertex_out(smooth_color_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.push_constant(0, Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.vertex_source("gpu_shader_3D_point_varying_size_varying_color_vert.glsl")
.fragment_source("gpu_shader_point_varying_color_frag.glsl")
.do_static_compilation(true);
@ -48,9 +48,9 @@ GPU_SHADER_CREATE_INFO(gpu_shader_3D_point_uniform_size_uniform_color_aa)
.vertex_in(0, Type::VEC3, "pos")
.vertex_out(smooth_radii_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.push_constant(0, Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(16, Type::VEC4, "color")
.push_constant(20, Type::FLOAT, "size")
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(Type::VEC4, "color")
.push_constant(Type::FLOAT, "size")
.vertex_source("gpu_shader_3D_point_uniform_size_aa_vert.glsl")
.fragment_source("gpu_shader_point_uniform_color_aa_frag.glsl")
.do_static_compilation(true);

View File

@ -29,7 +29,7 @@ GPU_SHADER_CREATE_INFO(gpu_shader_3D_smooth_color)
.vertex_in(1, Type::VEC4, "color")
.vertex_out(smooth_color_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.push_constant(0, Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.vertex_source("gpu_shader_3D_smooth_color_vert.glsl")
.fragment_source("gpu_shader_3D_smooth_color_frag.glsl")
.additional_info("gpu_srgb_to_framebuffer_space")

View File

@ -26,8 +26,8 @@
GPU_SHADER_CREATE_INFO(gpu_shader_3D_uniform_color)
.vertex_in(0, Type::VEC3, "pos")
.fragment_out(0, Type::VEC4, "fragColor")
.push_constant(0, Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(16, Type::VEC4, "color")
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(Type::VEC4, "color")
.vertex_source("gpu_shader_3D_vert.glsl")
.fragment_source("gpu_shader_uniform_color_frag.glsl")
.additional_info("gpu_srgb_to_framebuffer_space")

View File

@ -41,8 +41,8 @@ GPU_SHADER_CREATE_INFO(gpu_shader_gpencil_stroke)
.uniform_buf(0, "GPencilStrokeData", "gpencil_stroke_data")
.push_constant(0, Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(16, Type::MAT4, "ProjectionMatrix")
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(Type::MAT4, "ProjectionMatrix")
.vertex_source("gpu_shader_gpencil_stroke_vert.glsl")
.geometry_source("gpu_shader_gpencil_stroke_geom.glsl")
.fragment_source("gpu_shader_gpencil_stroke_frag.glsl")

View File

@ -31,7 +31,7 @@ GPU_SHADER_CREATE_INFO(gpu_shader_instance_varying_color_varying_size)
.vertex_in(3, Type::FLOAT, "size")
.vertex_out(flat_color_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.push_constant(0, Type::MAT4, "ViewProjectionMatrix")
.push_constant(Type::MAT4, "ViewProjectionMatrix")
.vertex_source("gpu_shader_instance_variying_size_variying_color_vert.glsl")
.fragment_source("gpu_shader_flat_color_frag.glsl")
.additional_info("gpu_srgb_to_framebuffer_space")

View File

@ -38,9 +38,9 @@ GPU_SHADER_CREATE_INFO(gpu_shader_keyframe_shape)
.vertex_in(4, Type ::INT, "flags")
.vertex_out(keyframe_shape_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.push_constant(0, Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(16, Type::VEC2, "ViewportSize")
.push_constant(24, Type::FLOAT, "outline_scale")
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(Type::VEC2, "ViewportSize")
.push_constant(Type::FLOAT, "outline_scale")
.vertex_source("gpu_shader_keyframe_shape_vert.glsl")
.fragment_source("gpu_shader_keyframe_shape_frag.glsl")
.do_static_compilation(true);

View File

@ -32,8 +32,8 @@ GPU_SHADER_CREATE_INFO(gpu_shader_simple_lighting)
.vertex_out(smooth_normal_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.uniform_buf(0, "SimpleLightingData", "simple_lighting_data", Frequency::PASS)
.push_constant(0, Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(16, Type::MAT3, "NormalMatrix")
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(Type::MAT3, "NormalMatrix")
.typedef_source("GPU_shader_shared.h")
.vertex_source("gpu_shader_3D_normal_vert.glsl")
.fragment_source("gpu_shader_simple_lighting_frag.glsl")

View File

@ -37,7 +37,7 @@ GPU_SHADER_CREATE_INFO(gpu_shader_text)
.vertex_in(3, Type ::INT, "offset")
.vertex_out(text_iface)
.fragment_out(0, Type::VEC4, "fragColor")
.push_constant(0, Type::MAT4, "ModelViewProjectionMatrix")
.push_constant(Type::MAT4, "ModelViewProjectionMatrix")
.sampler(0, ImageType::FLOAT_2D, "glyph", Frequency::PASS)
.vertex_source("gpu_shader_text_vert.glsl")
.fragment_source("gpu_shader_text_frag.glsl")