Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
VkCV Framework
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Vulkan2021
VkCV Framework
Merge requests
!74
Resolve "Mesh Shader Implementation"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Resolve "Mesh Shader Implementation"
87-mesh-shader-implementation
into
develop
Overview
1
Commits
47
Pipelines
39
Changes
5
Merged
Ghost User
requested to merge
87-mesh-shader-implementation
into
develop
3 years ago
Overview
1
Commits
47
Pipelines
39
Changes
5
Expand
Closes
#87 (closed)
Edited
3 years ago
by
Tobias Frisch
0
0
Merge request reports
Viewing commit
1df2d12b
Prev
Next
Show latest version
5 files
+
49
−
24
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
5
Search (e.g. *.vue) (Ctrl+P)
1df2d12b
[
#87
] adding SSBO to mesh shader pipeline
· 1df2d12b
Sebastian Gaida
authored
3 years ago
projects/mesh_shader/resources/shaders/shader.task
0 → 100644
+
78
−
0
Options
#version 460
#extension GL_ARB_separate_shader_objects : enable
#extension GL_NV_mesh_shader : require
#extension GL_GOOGLE_include_directive : enable
#include "meshlet.inc"
#include "common.inc"
layout(local_size_x=32) in;
taskNV out Task {
uint meshletIndices[32];
mat4 mvp;
} OUT;
layout( push_constant ) uniform constants{
uint matrixIndex;
uint meshletCount;
};
// TODO: reuse mesh stage binding at location 2 after required fix in framework
layout(std430, binding = 5) readonly buffer meshletBuffer
{
Meshlet meshlets[];
};
struct Plane{
vec3 pointOnPlane;
float padding0;
vec3 normal;
float padding1;
};
layout(set=0, binding=3, std140) uniform cameraPlaneBuffer{
Plane cameraPlanes[6];
};
layout(std430, binding = 4) readonly buffer matrixBuffer
{
ObjectMatrices objectMatrices[];
};
shared uint taskCount;
bool isSphereInsideFrustum(vec3 spherePos, float sphereRadius, Plane cameraPlanes[6]){
bool isInside = true;
for(int i = 0; i < 6; i++){
Plane p = cameraPlanes[i];
isInside = isInside && dot(p.normal, spherePos - p.pointOnPlane) - sphereRadius < 0;
}
return isInside;
}
void main() {
if(gl_LocalInvocationID.x >= meshletCount){
return;
}
uint meshletIndex = gl_GlobalInvocationID.x;
Meshlet meshlet = meshlets[meshletIndex];
if(gl_LocalInvocationID.x == 0){
taskCount = 0;
}
// TODO: scaling support
vec3 meshletPositionWorld = (vec4(meshlet.meanPosition, 1) * objectMatrices[matrixIndex].model).xyz;
if(isSphereInsideFrustum(meshletPositionWorld, meshlet.boundingSphereRadius, cameraPlanes)){
uint outIndex = atomicAdd(taskCount, 1);
OUT.meshletIndices[outIndex] = gl_GlobalInvocationID.x;
}
if(gl_LocalInvocationID.x == 0){
gl_TaskCountNV = taskCount;
OUT.mvp = objectMatrices[matrixIndex].mvp;
}
}
\ No newline at end of file
Loading