Render basics
This commit is contained in:
@@ -60,13 +60,17 @@ layout(binding = DRAW_COUNT_BUFFER_BINDING, std430) restrict buffer DrawCommandC
|
||||
uint cmdGenDispatchX;
|
||||
uint cmdGenDispatchY;
|
||||
uint cmdGenDispatchZ;
|
||||
|
||||
uint opaqueDrawCount;
|
||||
uint translucentDrawCount;
|
||||
|
||||
uint pad_A;
|
||||
DrawCommand cullDrawIndirectCommand;
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef SECTION_METADA_BUFFER_BINDING
|
||||
layout(binding = SECTION_METADA_BUFFER_BINDING, std430) readonly restrict buffer SectionBuffer {
|
||||
#ifdef SECTION_METADATA_BUFFER_BINDING
|
||||
layout(binding = SECTION_METADATA_BUFFER_BINDING, std430) readonly restrict buffer SectionBuffer {
|
||||
SectionMeta sectionData[];
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -5,7 +5,7 @@ layout(local_size_x = 128) in;
|
||||
|
||||
#define DRAW_BUFFER_BINDING 1
|
||||
#define DRAW_COUNT_BUFFER_BINDING 2
|
||||
#define SECTION_METADA_BUFFER_BINDING 3
|
||||
#define SECTION_METADATA_BUFFER_BINDING 3
|
||||
#define VISIBILITY_BUFFER_BINDING 4
|
||||
#define INDIRECT_SECTION_LOOKUP_BINDING 5
|
||||
|
||||
@@ -97,8 +97,8 @@ void main() {
|
||||
//Translucency
|
||||
count = meta.cntA&0xFFFF;
|
||||
if (count != 0) {
|
||||
uint translucentCommandPtr = atomicAdd(translucentDrawCount, 1) + 400000;//FIXME: dont hardcode this offset
|
||||
writeCmd(translucentCommandPtr, encodedPos, ptr, count);
|
||||
//uint translucentCommandPtr = atomicAdd(translucentDrawCount, 1) + 400000;//FIXME: dont hardcode this offset
|
||||
//writeCmd(translucentCommandPtr, encodedPos, ptr, count);
|
||||
}
|
||||
ptr += count;
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#version 460 core
|
||||
#extension GL_ARB_gpu_shader_int64 : enable
|
||||
#define VISIBILITY_ACCESS writeonly
|
||||
#define VISIBILITY_BUFFER_BINDING 2
|
||||
#import <voxy:lod/gl46/bindings.glsl>
|
||||
layout(early_fragment_tests) in;
|
||||
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
#version 460 core
|
||||
#extension GL_ARB_gpu_shader_int64 : enable
|
||||
#define VISIBILITY_ACCESS writeonly
|
||||
|
||||
#define SECTION_METADATA_BUFFER_BINDING 1
|
||||
#define VISIBILITY_BUFFER_BINDING 2
|
||||
#define INDIRECT_SECTION_LOOKUP_BINDING 3
|
||||
|
||||
#import <voxy:lod/gl46/bindings.glsl>
|
||||
#import <voxy:lod/section.glsl>
|
||||
|
||||
@@ -8,7 +13,7 @@ flat out uint id;
|
||||
flat out uint value;
|
||||
|
||||
void main() {
|
||||
uint sid = gl_InstanceID;
|
||||
uint sid = indirectLookup[gl_InstanceID];
|
||||
|
||||
SectionMeta section = sectionData[sid];
|
||||
|
||||
@@ -25,6 +30,6 @@ void main() {
|
||||
gl_Position = MVP * vec4(vec3(pos),1);
|
||||
|
||||
//Write to this id
|
||||
id = sid;
|
||||
id = gl_InstanceID;//Note!! we write to the instance id _not_ the section id
|
||||
value = frameId;
|
||||
}
|
||||
23
src/main/resources/assets/voxy/shaders/lod/gl46/prep.comp
Normal file
23
src/main/resources/assets/voxy/shaders/lod/gl46/prep.comp
Normal file
@@ -0,0 +1,23 @@
|
||||
#version 450
|
||||
|
||||
layout(local_size_x = 1) in;
|
||||
|
||||
#define DRAW_COUNT_BUFFER_BINDING 1
|
||||
#define INDIRECT_SECTION_LOOKUP_BINDING 2
|
||||
|
||||
#import <voxy:lod/gl46/bindings.glsl>
|
||||
|
||||
void main() {
|
||||
cmdGenDispatchX = ((sectionCount+127)/128);
|
||||
cmdGenDispatchY = 1;
|
||||
cmdGenDispatchZ = 1;
|
||||
|
||||
opaqueDrawCount = 0;
|
||||
translucentDrawCount = 0;
|
||||
|
||||
cullDrawIndirectCommand.count = 6*2*3;
|
||||
cullDrawIndirectCommand.instanceCount = sectionCount;
|
||||
cullDrawIndirectCommand.firstIndex = (1<<16)*6*2;
|
||||
cullDrawIndirectCommand.baseVertex = 0;
|
||||
cullDrawIndirectCommand.baseInstance = 0;
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
#extension GL_ARB_gpu_shader_int64 : enable
|
||||
|
||||
#define QUAD_BUFFER_BINDING 1
|
||||
#define SECTION_METADA_BUFFER_BINDING 2
|
||||
#define SECTION_METADATA_BUFFER_BINDING 2
|
||||
#define MODEL_BUFFER_BINDING 3
|
||||
#define MODEL_COLOUR_BUFFER_BINDING 4
|
||||
#define LIGHTING_BUFFER_BINDING 5
|
||||
|
||||
Reference in New Issue
Block a user