Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#ifndef _NODE_DATA_INPUT_CMN_
#define _NODE_DATA_INPUT_CMN_

vec4 positionFromDepth(in float depth,
                       in mat4 invProjectionMatrix,
                       in vec2 uv) {

    vec4 pos = vec4(2.0 * uv.x - 1.0,
        2.0 * uv.y - 1.0,
        2.0 * depth - 1.0,
        1.0);

    pos = invProjectionMatrix * pos;
    pos /= pos.w;

    return pos;
}

#if defined(COMPUTE_SHADER)
struct IndirectDrawCommand {
    uint count;
    uint instanceCount;
    uint firstIndex;
    uint baseVertex;
    uint baseInstance;
};

layout(binding = BUFFER_GPU_COMMANDS, std430) coherent buffer dvd_GPUCmds
{
    IndirectDrawCommand dvd_drawCommands[MAX_VISIBLE_NODES];
};
#endif

// This could be split up in the future into frequent-infrequent blocks depending on update rate
layout(binding = BUFFER_GPU_BLOCK, std140) uniform dvd_GPUBlock
{
    mat4  dvd_ProjectionMatrix;
    mat4  dvd_InvProjectionMatrix;
    mat4  dvd_ViewMatrix;
    mat4  dvd_ViewProjectionMatrix;
    vec4  dvd_cameraPosition; ///xyz - position, w - aspect ratio
    vec4  dvd_ViewPort;
    vec4  dvd_ZPlanesCombined; //xy - current, zw - main scene
    vec4  dvd_renderProperties;
    vec4  dvd_frustumPlanes[MAX_CLIP_PLANES];
    vec4  dvd_clip_plane[MAX_CLIP_PLANES];
};

vec2 dvd_invScreenDimensions() {
    return dvd_ViewPort.zw * 0.5;
}

#define dvd_shadowArrayOffset int(dvd_renderProperties.x)
#define dvd_GSInvocationLimit int(dvd_renderProperties.y)
#define dvd_aspectRatio dvd_cameraPosition.w
#define dvd_fieldOfView dvd_renderProperties.z
#define dvd_tanHalfFieldOfView dvd_renderProperties.w

layout(binding = BUFFER_SCENE_DATA, std140) uniform dvd_SceneData
{
    vec4   dvd_fogDetails;
    vec4   dvd_windDetails;
    vec4   dvd_shadowingSettings;
    vec4   dvd_otherData;
    vec4   dvd_otherData2;
    uvec4  dvd_lightCountPerType;
    vec4   dvd_waterPositionsW/*[MAX_WATER_BODIES]*/;
    //x = width, y = length, z = depth
    vec4   dvd_waterDetails/*[MAX_WATER_BODIES]*/;
};

#define dvd_fogColour dvd_fogDetails.xyz
#define dvd_fogDensity dvd_fogDetails.w
#define dvd_time int(dvd_otherData.x)
#define dvd_showDebugInfo int(dvd_otherData.y)

int dvd_deltaTime() {
    return int(dvd_otherData2.x);
}

bool dvd_shadowsEnabled() {
    return int(dvd_otherData.z) == 1;
}

int dvd_renderDetailLevel() {
    return int(dvd_otherData2.y);
}

int dvd_shadowDetailLevel() {
    return int(dvd_otherData2.z);
}

#if defined(VERT_SHADER) || defined(GEOM_SHADER)
out float gl_ClipDistance[MAX_CLIP_PLANES];

void setClipPlanes(in vec4 worldSpaceVertex) {
    for(int i = 0; i < MAX_CLIP_PLANES; ++i) {
        gl_ClipDistance[i] = dot(worldSpaceVertex, dvd_clip_plane[i]);
    }
}
#elif defined(FRAG_SHADER)
#if GPU_VENDOR == GPU_VENDOR_AMD
in float gl_ClipDistance[MAX_CLIP_PLANES];
#endif
#endif

//mix(false, true, condition);

#endif //_NODE_DATA_INPUT_CMN_

Commits for Divide-Framework/trunk/assets/shaders/GLSL/common/nodeDataInput.cmn

Diff revisions: vs.
Revision Author Commited Message
888 Diff Diff IonutCava picture IonutCava Mon 03 Apr, 2017 20:04:19 +0000

[IonutCava]
- Terrain <-> Water body collision checking for caustics

886 Diff Diff IonutCava picture IonutCava Wed 29 Mar, 2017 23:36:51 +0000

[Ionut]
- Initial code for multiple water block support (position + length/width/depth)

879 Diff Diff IonutCava picture IonutCava Sun 19 Mar, 2017 19:29:46 +0000

[IonutCava]
- GLSL updates:
— Interface block correction to support tessellation shaders automatically
— Fixed line counting issues with the preprocessor

850 Diff Diff IonutCava picture IonutCava Mon 06 Feb, 2017 17:04:39 +0000

[IonutCava]
- More code rot fixes
- Separate Planar reflectors/refractors from Cube R/R
- Now passing detail levels to shaders

812 Diff Diff IonutCava picture IonutCava Wed 11 Jan, 2017 21:38:18 +0000

[IonutCava]
- Finish terrain shader fixes (AMD GPU related issues)

809 Diff Diff IonutCava picture IonutCava Tue 10 Jan, 2017 17:16:26 +0000

[IonutCava]
- Move velocity calc to the normal colour pass.
- Optimise glFramebuffer and cleanup RTAttachment class

800 Diff Diff IonutCava picture IonutCava Fri 25 Nov, 2016 17:04:02 +0000

[IonutCava]
- More profile-guided optimizations
- Added GLSL normal map blending methods from: http://blog.selfshadow.com/sandbox/normals.html
- Added more profile timers

786 Diff Diff IonutCava picture IonutCava Tue 18 Oct, 2016 19:42:56 +0000

[IonutCava]
- Initial code for overriding the default camera. Added as part of the scene state.

785 Diff Diff IonutCava picture IonutCava Tue 18 Oct, 2016 16:14:27 +0000

[IonutCava]
- Added better rendering debugging functionality (named render targets. Helps with GPU Profiling tools)
- Limit clip planes to the number of frustum planes (that should be enough and it also simplifies the code)

770 IonutCava picture IonutCava Tue 20 Sep, 2016 16:12:27 +0000

[IonutCava]
- Prepare velocity map calculation (later used for temporal AA and motion blur):
— Add a previous depth buffer render target that blits the main depth buffer at the end of the frame
— Add a new render target to the screen FBO: velocity map
- Store normals as RG instead of RGB and pack/unpack in shaders. (compute >>>> bandwith)
- Rename Forward+ renderer to something more descriptive

(Requires deletion of all parsed & cached data)