Revert "GPUShaderCreateInfo for interface abstraction"
This reverts commit 8fb2ff458b.
Missing some files.
This commit is contained in:
@@ -3,6 +3,10 @@
|
||||
|
||||
#define CAVITY_BUFFER_RANGE 4.0
|
||||
|
||||
#ifdef WORKBENCH_ENCODE_NORMALS
|
||||
|
||||
# define WB_Normal vec2
|
||||
|
||||
/* From http://aras-p.info/texts/CompactNormalStorage.html
|
||||
* Using Method #4: Spheremap Transform */
|
||||
vec3 workbench_normal_decode(vec4 enc)
|
||||
@@ -18,7 +22,7 @@ vec3 workbench_normal_decode(vec4 enc)
|
||||
|
||||
/* From http://aras-p.info/texts/CompactNormalStorage.html
|
||||
* Using Method #4: Spheremap Transform */
|
||||
vec2 workbench_normal_encode(bool front_face, vec3 n)
|
||||
WB_Normal workbench_normal_encode(bool front_face, vec3 n)
|
||||
{
|
||||
n = normalize(front_face ? n : -n);
|
||||
float p = sqrt(n.z * 8.0 + 8.0);
|
||||
@@ -26,6 +30,13 @@ vec2 workbench_normal_encode(bool front_face, vec3 n)
|
||||
return n.xy;
|
||||
}
|
||||
|
||||
#else
|
||||
# define WB_Normal vec3
|
||||
/* Well just do nothing... */
|
||||
# define workbench_normal_encode(f, a) (a)
|
||||
# define workbench_normal_decode(a) (a.xyz)
|
||||
#endif /* WORKBENCH_ENCODE_NORMALS */
|
||||
|
||||
/* Encoding into the alpha of a RGBA16F texture. (10bit mantissa) */
|
||||
#define TARGET_BITCOUNT 8u
|
||||
#define METALLIC_BITS 3u /* Metallic channel is less important. */
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
|
||||
#ifndef WORKBENCH_SHADER_SHARED_H
|
||||
struct LightData {
|
||||
vec4 direction;
|
||||
vec4 specular_color;
|
||||
@@ -39,10 +37,9 @@ struct WorldData {
|
||||
int _pad2;
|
||||
};
|
||||
|
||||
# define viewport_size_inv viewport_size.zw
|
||||
#define viewport_size_inv viewport_size.zw
|
||||
|
||||
layout(std140) uniform world_block
|
||||
{
|
||||
WorldData world_data;
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -4,8 +4,6 @@
|
||||
#pragma BLENDER_REQUIRE(workbench_cavity_lib.glsl)
|
||||
#pragma BLENDER_REQUIRE(workbench_curvature_lib.glsl)
|
||||
|
||||
#ifndef DRW_SHADER_SHARED_H
|
||||
|
||||
uniform sampler2D depthBuffer;
|
||||
uniform sampler2D normalBuffer;
|
||||
uniform usampler2D objectIdBuffer;
|
||||
@@ -14,8 +12,6 @@ in vec4 uvcoordsvar;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
#endif
|
||||
|
||||
void main()
|
||||
{
|
||||
float cavity = 0.0, edges = 0.0, curvature = 0.0;
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
|
||||
#include "gpu_shader_create_info.hh"
|
||||
|
||||
GPU_SHADER_CREATE_INFO(workbench_effect_cavity_common)
|
||||
.fragment_out(0, Type::VEC4, "fragColor")
|
||||
.sampler(0, ImageType::FLOAT_2D, "depthBuffer")
|
||||
.sampler(1, ImageType::FLOAT_2D, "normalBuffer")
|
||||
.sampler(2, ImageType::UINT_2D, "objectIdBuffer")
|
||||
.uniform_buf(3, "vec4", "samples_coords[512]")
|
||||
.fragment_source("workbench_effect_cavity_frag.glsl")
|
||||
.additional_info("draw_fullscreen")
|
||||
.additional_info("draw_view");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(workbench_effect_cavity)
|
||||
.do_static_compilation(true)
|
||||
.define("USE_CAVITY")
|
||||
.additional_info("workbench_effect_cavity_common");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(workbench_effect_curvature)
|
||||
.do_static_compilation(true)
|
||||
.define("USE_CURVATURE")
|
||||
.additional_info("workbench_effect_cavity_common");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(workbench_effect_cavity_curvature)
|
||||
.do_static_compilation(true)
|
||||
.define("USE_CAVITY")
|
||||
.define("USE_CURVATURE")
|
||||
.additional_info("workbench_effect_cavity_common");
|
||||
@@ -25,14 +25,12 @@ bool node_tex_tile_lookup(inout vec3 co, sampler2DArray ima, sampler1DArray map)
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifndef WORKBENCH_SHADER_SHARED_H
|
||||
uniform sampler2DArray imageTileArray;
|
||||
uniform sampler1DArray imageTileData;
|
||||
uniform sampler2D imageTexture;
|
||||
|
||||
uniform float imageTransparencyCutoff = 0.1;
|
||||
uniform bool imagePremult;
|
||||
#endif
|
||||
|
||||
vec3 workbench_image_color(vec2 uvs)
|
||||
{
|
||||
|
||||
@@ -4,11 +4,9 @@
|
||||
#pragma BLENDER_REQUIRE(workbench_common_lib.glsl)
|
||||
#pragma BLENDER_REQUIRE(workbench_image_lib.glsl)
|
||||
|
||||
#ifndef WORKBENCH_SHADER_SHARED_H
|
||||
layout(location = 0) out vec4 materialData;
|
||||
layout(location = 1) out vec2 normalData;
|
||||
layout(location = 1) out WB_Normal normalData;
|
||||
layout(location = 2) out uint objectId;
|
||||
#endif
|
||||
|
||||
uniform bool useMatcap = false;
|
||||
|
||||
|
||||
@@ -5,10 +5,8 @@
|
||||
#pragma BLENDER_REQUIRE(workbench_material_lib.glsl)
|
||||
#pragma BLENDER_REQUIRE(workbench_image_lib.glsl)
|
||||
|
||||
#ifndef WORKBENCH_SHADER_SHARED_H
|
||||
uniform samplerBuffer ac; /* active color layer */
|
||||
uniform samplerBuffer au; /* active texture layer */
|
||||
#endif
|
||||
|
||||
/* From http://libnoise.sourceforge.net/noisegen/index.html */
|
||||
float integer_noise(int n)
|
||||
@@ -73,10 +71,8 @@ void main()
|
||||
|
||||
normal_interp = normalize(normal_world_to_view(nor));
|
||||
|
||||
#ifndef WORKBENCH_SHADER_SHARED_H
|
||||
# ifdef OPAQUE_MATERIAL
|
||||
#ifdef OPAQUE_MATERIAL
|
||||
float metallic, roughness;
|
||||
# endif
|
||||
#endif
|
||||
workbench_material_data_get(resource_handle, color_interp, alpha_interp, roughness, metallic);
|
||||
|
||||
|
||||
@@ -1,136 +0,0 @@
|
||||
|
||||
#include "gpu_shader_create_info.hh"
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Object Type
|
||||
* \{ */
|
||||
|
||||
GPU_SHADER_CREATE_INFO(workbench_mesh)
|
||||
.vertex_in(0, Type::VEC3, "pos")
|
||||
.vertex_in(1, Type::VEC3, "nor")
|
||||
.vertex_in(2, Type::VEC4, "ac")
|
||||
.vertex_in(3, Type::VEC2, "au")
|
||||
.vertex_source("workbench_prepass_vert.glsl")
|
||||
.additional_info("draw_mesh");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(workbench_hair)
|
||||
.sampler(0, ImageType::FLOAT_BUFFER, "ac", Frequency::BATCH)
|
||||
.sampler(1, ImageType::FLOAT_BUFFER, "au", Frequency::BATCH)
|
||||
.vertex_source("workbench_prepass_hair_vert.glsl")
|
||||
.additional_info("draw_hair");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(workbench_pointcloud)
|
||||
.vertex_source("workbench_prepass_pointcloud_vert.glsl")
|
||||
.additional_info("draw_pointcloud");
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Texture Type
|
||||
* \{ */
|
||||
|
||||
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")
|
||||
.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")
|
||||
.define("TEXTURE_IMAGE_ARRAY");
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Lighting Type
|
||||
* \{ */
|
||||
|
||||
GPU_SHADER_CREATE_INFO(workbench_lighting_studio).define("V3D_LIGHTING_STUDIO");
|
||||
GPU_SHADER_CREATE_INFO(workbench_lighting_matcap).define("V3D_LIGHTING_MATCAP");
|
||||
GPU_SHADER_CREATE_INFO(workbench_lighting_flat).define("V3D_LIGHTING_FLAT");
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Material Interface
|
||||
* \{ */
|
||||
|
||||
GPU_SHADER_INTERFACE_INFO(workbench_material_iface, "")
|
||||
.smooth(Type::VEC3, "normal_interp")
|
||||
.smooth(Type::VEC3, "color_interp")
|
||||
.smooth(Type::FLOAT, "alpha_interp")
|
||||
.smooth(Type::VEC2, "uv_interp")
|
||||
.flat(Type::INT, "object_id")
|
||||
.flat(Type::FLOAT, "roughness")
|
||||
.flat(Type::FLOAT, "metallic");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(workbench_material).vertex_out(workbench_material_iface);
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Pipeline Type
|
||||
* \{ */
|
||||
|
||||
GPU_SHADER_CREATE_INFO(workbench_transparent_accum)
|
||||
/* Note: Blending will be skipped on objectId because output is a
|
||||
non-normalized integer buffer. */
|
||||
.fragment_out(0, Type::VEC4, "transparentAccum")
|
||||
.fragment_out(1, Type::VEC4, "revealageAccum")
|
||||
.fragment_out(2, Type::UINT, "objectId")
|
||||
.uniform_buf(4, "WorldData", "world_data", Frequency::PASS)
|
||||
.typedef_source("workbench_shader_shared.h")
|
||||
.fragment_source("workbench_transparent_accum_frag.glsl")
|
||||
.additional_info("workbench_material");
|
||||
|
||||
GPU_SHADER_CREATE_INFO(workbench_opaque)
|
||||
.fragment_out(0, Type::VEC4, "materialData")
|
||||
.fragment_out(1, Type::VEC2, "normalData")
|
||||
.fragment_out(2, Type::UINT, "objectId")
|
||||
.uniform_buf(4, "WorldData", "world_data", Frequency::PASS)
|
||||
.typedef_source("workbench_shader_shared.h")
|
||||
.fragment_source("workbench_prepass_frag.glsl")
|
||||
.additional_info("workbench_material");
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Variations Declaration
|
||||
* \{ */
|
||||
|
||||
#define WORKBENCH_SURFACETYPE_VARIATIONS(prefix, ...) \
|
||||
GPU_SHADER_CREATE_INFO(prefix##_mesh) \
|
||||
.additional_info("workbench_mesh", __VA_ARGS__) \
|
||||
.do_static_compilation(true); \
|
||||
GPU_SHADER_CREATE_INFO(prefix##_hair) \
|
||||
.additional_info("workbench_hair", __VA_ARGS__) \
|
||||
.do_static_compilation(true); \
|
||||
GPU_SHADER_CREATE_INFO(prefix##_ptcloud) \
|
||||
.additional_info("workbench_pointcloud", __VA_ARGS__) \
|
||||
.do_static_compilation(true);
|
||||
|
||||
#define WORKBENCH_PIPELINE_VARIATIONS(prefix, ...) \
|
||||
WORKBENCH_SURFACETYPE_VARIATIONS(prefix##_transp_studio, \
|
||||
"workbench_transparent_accum", \
|
||||
"workbench_lighting_studio", \
|
||||
__VA_ARGS__) \
|
||||
WORKBENCH_SURFACETYPE_VARIATIONS(prefix##_transp_matcap, \
|
||||
"workbench_transparent_accum", \
|
||||
"workbench_lighting_matcap", \
|
||||
__VA_ARGS__) \
|
||||
WORKBENCH_SURFACETYPE_VARIATIONS(prefix##_transp_flat, \
|
||||
"workbench_transparent_accum", \
|
||||
"workbench_lighting_flat", \
|
||||
__VA_ARGS__) \
|
||||
WORKBENCH_SURFACETYPE_VARIATIONS(prefix##_opaque, "workbench_opaque", __VA_ARGS__)
|
||||
|
||||
WORKBENCH_PIPELINE_VARIATIONS(workbench_tex_none, "workbench_texture_none")
|
||||
WORKBENCH_PIPELINE_VARIATIONS(workbench_tex_single, "workbench_texture_single")
|
||||
WORKBENCH_PIPELINE_VARIATIONS(workbench_tex_tile, "workbench_texture_tile")
|
||||
|
||||
/** \} */
|
||||
@@ -21,10 +21,8 @@ void main()
|
||||
|
||||
uv_interp = vec2(0.0);
|
||||
|
||||
#ifndef WORKBENCH_SHADER_SHARED_H
|
||||
# ifdef OPAQUE_MATERIAL
|
||||
#ifdef OPAQUE_MATERIAL
|
||||
float metallic, roughness;
|
||||
# endif
|
||||
#endif
|
||||
workbench_material_data_get(resource_handle, color_interp, alpha_interp, roughness, metallic);
|
||||
|
||||
|
||||
@@ -5,12 +5,10 @@
|
||||
#pragma BLENDER_REQUIRE(workbench_material_lib.glsl)
|
||||
#pragma BLENDER_REQUIRE(workbench_image_lib.glsl)
|
||||
|
||||
#ifndef WORKBENCH_SHADER_SHARED_H
|
||||
in vec3 pos;
|
||||
in vec3 nor;
|
||||
in vec4 ac; /* active color */
|
||||
in vec2 au; /* active texture layer */
|
||||
#endif
|
||||
|
||||
void main()
|
||||
{
|
||||
@@ -25,10 +23,8 @@ void main()
|
||||
|
||||
normal_interp = normalize(normal_object_to_view(nor));
|
||||
|
||||
#ifndef WORKBENCH_SHADER_SHARED_H
|
||||
# ifdef OPAQUE_MATERIAL
|
||||
#ifdef OPAQUE_MATERIAL
|
||||
float metallic, roughness;
|
||||
# endif
|
||||
#endif
|
||||
workbench_material_data_get(resource_handle, color_interp, alpha_interp, roughness, metallic);
|
||||
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
|
||||
#ifndef WORKBENCH_SHADER_SHARED_H
|
||||
IN_OUT ShaderStageInterface
|
||||
{
|
||||
vec3 normal_interp;
|
||||
vec3 color_interp;
|
||||
float alpha_interp;
|
||||
vec2 uv_interp;
|
||||
# ifdef TRANSPARENT_MATERIAL
|
||||
#ifdef TRANSPARENT_MATERIAL
|
||||
flat float roughness;
|
||||
flat float metallic;
|
||||
# else
|
||||
#else
|
||||
flat float packed_rough_metal;
|
||||
# endif
|
||||
#endif
|
||||
flat int object_id;
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#pragma BLENDER_REQUIRE(workbench_matcap_lib.glsl)
|
||||
#pragma BLENDER_REQUIRE(workbench_world_light_lib.glsl)
|
||||
|
||||
#ifndef WORKBENCH_SHADER_SHARED_H
|
||||
/* Revealage is actually stored in transparentAccum alpha channel.
|
||||
* This is a workaround to older hardware not having separate blend equation per render target. */
|
||||
layout(location = 0) out vec4 transparentAccum;
|
||||
@@ -14,7 +13,6 @@ layout(location = 1) out vec4 revealageAccum;
|
||||
|
||||
/* NOTE: Blending will be skipped on objectId because output is a non-normalized integer buffer. */
|
||||
layout(location = 2) out uint objectId;
|
||||
#endif
|
||||
|
||||
/* Special function only to be used with calculate_transparent_weight(). */
|
||||
float linear_zdepth(float depth, vec4 viewvecs[2], mat4 proj_mat)
|
||||
|
||||
Reference in New Issue
Block a user