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
-- Compute

#include "HiZCullingAlgorithm.cmn";

//ref: http://malideveloper.arm.com/resources/sample-code/occlusion-culling-hierarchical-z/
struct NodeData {
    mat4 _worldMatrix;
    mat4 _normalMatrix;
    mat4 _colorMatrix;
    vec4 _properties;
};

layout(binding = BUFFER_NODE_INFO, std430) coherent buffer dvd_MatrixBlock
{
    NodeData dvd_Matrices[MAX_VISIBLE_NODES];
};

// x - isSelected/isHighlighted; y - isShadowMapped; z - lodLevel, w - reserved
#define dvd_customData(X) dvd_Matrices[X]._properties.w 

layout(location = 0) uniform uint dvd_numEntities;
layout(binding = 0, offset = 0) uniform atomic_uint culledCount;
layout(local_size_x = 64) in;

void main()
{
    uint ident = gl_GlobalInvocationID.x;
    
    if (ident >= dvd_numEntities) {
        dvd_drawCommands[ident].instanceCount = 0;
        return;
    }
    
    uint drawCount = dvd_drawCommands[ident].baseInstance;
    uint nodeIndex = dvd_drawCommands[ident].baseInstance;
    vec4 bSphere = dvd_Matrices[nodeIndex]._normalMatrix[3];
    vec3 center = bSphere.xyz;
    float radius = bSphere.w;

    
    // Sphere clips against near plane, just assume visibility.
    if ((dvd_ViewMatrix * vec4(center, 1.0)).z + radius >= -dvd_ZPlanesCombined.z) {
        return;
    }

    if (zBufferCull(center, vec3(radius)) == 0) {
        atomicCounterIncrement(culledCount);
        //dvd_drawCommands[ident].instanceCount = 0;
        //dvd_customData(nodeIndex) = 3.0;
    }
}

Commits for Divide-Framework/trunk/assets/shaders/GLSL/HiZOcclusionCull.glsl

Diff revisions: vs.
Revision Author Commited Message
631 Diff Diff IonutCava picture IonutCava Sun 24 Jan, 2016 20:28:21 +0000

[IonutCava]
- Fix and optimize particle rendering system
- Temporarily disable Z_PRE_PASS system for testing
- Improve thread pool destruction system a bit
- Fix texture loading when used as fb attachment
- Forward+ renderer now takes the entire light buffer (no need to split up by light type)
- Start work on occlusion culling fixes:
— ToDo: Take into account batching system
— Fix gl_DrawIDARB usage

617 Diff Diff IonutCava picture IonutCava Tue 05 Jan, 2016 16:47:21 +0000

[IonutCava]
- Depth writing is now a rendering API level toggle instead of a renderstateblock option
- Z-Pre-pass fixes and improvements
- Moved normal render target to the display stage from the pre-pass stage
— Normals are only used in post-processing. This improves pre-pass performance

585 Diff Diff IonutCava picture IonutCava Wed 25 Nov, 2015 14:44:18 +0000

[IonutCava]
- DrawCommand / NodeData synchronization fixes
- Reduce memory usage for the node buffer by packing the bounding sphere in the normal matrix’s available row

584 Diff Diff IonutCava picture IonutCava Tue 24 Nov, 2015 23:06:01 +0000

[IonutCava]
- Small corrections to occlusion culling
- Cleanup draw command indexing (still hacky – needs a better solution)
- Fix dwarf.x emissive values

582 Diff Diff IonutCava picture IonutCava Mon 23 Nov, 2015 21:12:14 +0000

[IonutCava]
- Re-enable persistent mapping (disabled by accident)
- Small correction to occlusion culling counter
- Remove unused shader program function

575 Diff Diff IonutCava picture IonutCava Thu 19 Nov, 2015 23:30:58 +0000

[IonutCava]
- More buffer management work
- mat4 setRow/setCol fix

566 Diff Diff IonutCava picture IonutCava Sat 14 Nov, 2015 18:34:27 +0000

[IonutCava]
- Cleanup GLSL UBO variables
- Cleanup mat4 class
- Fixed fog rendering
- Disable useless environment mipmap generation step

553 Diff Diff IonutCava picture IonutCava Sun 08 Nov, 2015 21:48:10 +0000

[IonutCava]
- Improve VBO allocation system
- Disable mipmap generation for blur FBO in CascadedShadowMaps
- Code cleanup

535 Diff Diff IonutCava picture IonutCava Tue 27 Oct, 2015 17:03:35 +0000

[IonutCava]
- Improve occlusion culling
- Improve draw command management

531 IonutCava picture IonutCava Tue 20 Oct, 2015 20:49:20 +0000

[IonutCava]
- Workaround for mismatching GLSL version
- Some cleanups