wip hiz
This commit is contained in:
9
src/main/resources/assets/voxy/shaders/hiz/blit.fsh
Normal file
9
src/main/resources/assets/voxy/shaders/hiz/blit.fsh
Normal file
@@ -0,0 +1,9 @@
|
||||
#version 450
|
||||
|
||||
|
||||
layout(location = 0) in vec2 uv;
|
||||
layout(binding = 0) uniform sampler2D depthTex;
|
||||
void main() {
|
||||
vec4 depths = textureGather(depthTex, uv, 0); // Get depth values from all surrounding texels.
|
||||
gl_FragDepth = max(max(depths.x, depths.y), max(depths.z, depths.w)); // Write conservative depth.
|
||||
}
|
||||
8
src/main/resources/assets/voxy/shaders/hiz/blit.vsh
Normal file
8
src/main/resources/assets/voxy/shaders/hiz/blit.vsh
Normal file
@@ -0,0 +1,8 @@
|
||||
#version 450
|
||||
|
||||
layout(location = 0) out vec2 uv;
|
||||
void main() {
|
||||
vec2 corner = vec2[](vec2(0,0), vec2(1,0), vec2(1,1),vec2(0,1))[gl_VertexID];
|
||||
uv = corner;
|
||||
gl_Position = vec4(corner*2-1, 0, 1);
|
||||
}
|
||||
@@ -7,7 +7,7 @@
|
||||
#import <voxy:lod/section.glsl>
|
||||
#define extractMeshletStart extractQuadStart
|
||||
layout(local_size_x = 64) in;
|
||||
#define QUADS_PER_MESHLET 62
|
||||
#define QUADS_PER_MESHLET 30
|
||||
|
||||
void emitMeshlets(inout uint mli, inout uint meshletPtr, uint mskedCnt, uint cnt) {
|
||||
for (;mskedCnt != 0; mskedCnt--,mli++) {
|
||||
|
||||
@@ -10,6 +10,7 @@ layout(location = 2) in flat vec4 tinting;
|
||||
layout(location = 3) in flat vec4 addin;
|
||||
layout(location = 4) in flat uint flags;
|
||||
layout(location = 5) in flat vec4 conditionalTinting;
|
||||
layout(location = 6) in flat uint meshlet;
|
||||
//layout(location = 6) in flat vec4 solidColour;
|
||||
|
||||
layout(location = 0) out vec4 outColour;
|
||||
@@ -29,4 +30,13 @@ void main() {
|
||||
outColour = (colour * tinting) + addin;
|
||||
|
||||
//outColour = vec4(uv + baseUV, 0, 1);
|
||||
|
||||
/*
|
||||
uint hash = meshlet*1231421+123141;
|
||||
hash ^= hash>>16;
|
||||
hash = hash*1231421+123141;
|
||||
hash ^= hash>>16;
|
||||
|
||||
outColour = vec4(float(hash&15u)/15, float((hash>>4)&15u)/15, float((hash>>8)&15u)/15, 1);
|
||||
*/
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
#version 450
|
||||
#extension GL_ARB_gpu_shader_int64 : enable
|
||||
#define QUADS_PER_MESHLET 62
|
||||
#define QUADS_PER_MESHLET 30
|
||||
|
||||
#define MESHLET_ACCESS readonly
|
||||
//There are 16 bytes of metadata at the start of the meshlet
|
||||
@@ -36,6 +36,7 @@ uint extractDetail(PosHeader pos) {
|
||||
}
|
||||
#endif
|
||||
|
||||
layout(location = 6) out flat uint meshlet;
|
||||
PosHeader meshletPosition;
|
||||
Quad quad;
|
||||
bool setupMeshlet() {
|
||||
@@ -49,6 +50,7 @@ bool setupMeshlet() {
|
||||
return true;
|
||||
}
|
||||
|
||||
meshlet = data;
|
||||
uint baseId = (data*MESHLET_SIZE);
|
||||
uint quadIndex = baseId + (gl_VertexID>>2) + 2;
|
||||
meshletPosition = geometryPool[baseId];
|
||||
|
||||
Reference in New Issue
Block a user