No Recursion?
This commit is contained in:
+43
-39
@@ -60,45 +60,49 @@ void main()
|
||||
positions[i].x += (bounds[0]-bounds[3])*0.25 * (mod(gl_LocalInvocationID.x,4.)-1.5);
|
||||
positions[i].y += (bounds[1]-bounds[4])*0.25 * (mod(floor(gl_LocalInvocationID.x/4.),4.)-1.5);
|
||||
positions[i].z += (bounds[2]-bounds[5])*0.25 * (floor(gl_LocalInvocationID.x/16.)-1.5+gl_WorkGroupID.z*2.);
|
||||
}
|
||||
}
|
||||
|
||||
//mat4 sw=pc.world;
|
||||
gl_MeshVerticesEXT[vindex+0].gl_Position=mvp*(positions[0]);
|
||||
gl_MeshVerticesEXT[vindex+1].gl_Position=mvp*(positions[1]);
|
||||
gl_MeshVerticesEXT[vindex+2].gl_Position=mvp*(positions[2]);
|
||||
gl_MeshVerticesEXT[vindex+3].gl_Position=mvp*(positions[3]);
|
||||
gl_MeshVerticesEXT[vindex+4].gl_Position=mvp*(positions[4]);
|
||||
gl_MeshVerticesEXT[vindex+5].gl_Position=mvp*(positions[5]);
|
||||
gl_MeshVerticesEXT[vindex+6].gl_Position=mvp*(positions[6]);
|
||||
gl_MeshVerticesEXT[vindex+7].gl_Position=mvp*(positions[7]);
|
||||
vertexOutput[vindex+0].position=(positions[0]);
|
||||
vertexOutput[vindex+1].position=(positions[1]);
|
||||
vertexOutput[vindex+2].position=(positions[2]);
|
||||
vertexOutput[vindex+3].position=(positions[3]);
|
||||
vertexOutput[vindex+4].position=(positions[4]);
|
||||
vertexOutput[vindex+5].position=(positions[5]);
|
||||
vertexOutput[vindex+6].position=(positions[6]);
|
||||
vertexOutput[vindex+7].position=(positions[7]);
|
||||
|
||||
if(signingvec.x>0){
|
||||
gl_PrimitiveTriangleIndicesEXT[pindex+0]=uvec3(4,5,6)+uvec3(vindex);
|
||||
gl_PrimitiveTriangleIndicesEXT[pindex+1]=uvec3(5,6,7)+uvec3(vindex);
|
||||
}else{
|
||||
gl_PrimitiveTriangleIndicesEXT[pindex+0]=uvec3(0,1,2)+uvec3(vindex);
|
||||
gl_PrimitiveTriangleIndicesEXT[pindex+1]=uvec3(1,2,3)+uvec3(vindex);
|
||||
}
|
||||
if(signingvec.y>0){
|
||||
gl_PrimitiveTriangleIndicesEXT[pindex+2]=uvec3(2,3,6)+uvec3(vindex);
|
||||
gl_PrimitiveTriangleIndicesEXT[pindex+3]=uvec3(7,3,6)+uvec3(vindex);
|
||||
}else{
|
||||
gl_PrimitiveTriangleIndicesEXT[pindex+2]=uvec3(0,1,4)+uvec3(vindex);
|
||||
gl_PrimitiveTriangleIndicesEXT[pindex+3]=uvec3(5,1,4)+uvec3(vindex);
|
||||
}
|
||||
if(signingvec.z>0){
|
||||
gl_PrimitiveTriangleIndicesEXT[pindex+4]=uvec3(1,3,5)+uvec3(vindex);
|
||||
gl_PrimitiveTriangleIndicesEXT[pindex+5]=uvec3(3,5,7)+uvec3(vindex);
|
||||
}else{
|
||||
gl_PrimitiveTriangleIndicesEXT[pindex+4]=uvec3(0,2,4)+uvec3(vindex);
|
||||
gl_PrimitiveTriangleIndicesEXT[pindex+5]=uvec3(2,4,6)+uvec3(vindex);
|
||||
float[2] check = scene(vec3[2](vec3(positions[0].xyz),vec3(positions[7].xyz)), true);
|
||||
if ((check[0] < 0) && (check[1] > 0))
|
||||
{
|
||||
//mat4 sw=pc.world;
|
||||
gl_MeshVerticesEXT[vindex+0].gl_Position=mvp*(positions[0]);
|
||||
gl_MeshVerticesEXT[vindex+1].gl_Position=mvp*(positions[1]);
|
||||
gl_MeshVerticesEXT[vindex+2].gl_Position=mvp*(positions[2]);
|
||||
gl_MeshVerticesEXT[vindex+3].gl_Position=mvp*(positions[3]);
|
||||
gl_MeshVerticesEXT[vindex+4].gl_Position=mvp*(positions[4]);
|
||||
gl_MeshVerticesEXT[vindex+5].gl_Position=mvp*(positions[5]);
|
||||
gl_MeshVerticesEXT[vindex+6].gl_Position=mvp*(positions[6]);
|
||||
gl_MeshVerticesEXT[vindex+7].gl_Position=mvp*(positions[7]);
|
||||
vertexOutput[vindex+0].position=(positions[0]);
|
||||
vertexOutput[vindex+1].position=(positions[1]);
|
||||
vertexOutput[vindex+2].position=(positions[2]);
|
||||
vertexOutput[vindex+3].position=(positions[3]);
|
||||
vertexOutput[vindex+4].position=(positions[4]);
|
||||
vertexOutput[vindex+5].position=(positions[5]);
|
||||
vertexOutput[vindex+6].position=(positions[6]);
|
||||
vertexOutput[vindex+7].position=(positions[7]);
|
||||
|
||||
if(signingvec.x>0){
|
||||
gl_PrimitiveTriangleIndicesEXT[pindex+0]=uvec3(4,5,6)+uvec3(vindex);
|
||||
gl_PrimitiveTriangleIndicesEXT[pindex+1]=uvec3(5,6,7)+uvec3(vindex);
|
||||
}else{
|
||||
gl_PrimitiveTriangleIndicesEXT[pindex+0]=uvec3(0,1,2)+uvec3(vindex);
|
||||
gl_PrimitiveTriangleIndicesEXT[pindex+1]=uvec3(1,2,3)+uvec3(vindex);
|
||||
}
|
||||
if(signingvec.y>0){
|
||||
gl_PrimitiveTriangleIndicesEXT[pindex+2]=uvec3(2,3,6)+uvec3(vindex);
|
||||
gl_PrimitiveTriangleIndicesEXT[pindex+3]=uvec3(7,3,6)+uvec3(vindex);
|
||||
}else{
|
||||
gl_PrimitiveTriangleIndicesEXT[pindex+2]=uvec3(0,1,4)+uvec3(vindex);
|
||||
gl_PrimitiveTriangleIndicesEXT[pindex+3]=uvec3(5,1,4)+uvec3(vindex);
|
||||
}
|
||||
if(signingvec.z>0){
|
||||
gl_PrimitiveTriangleIndicesEXT[pindex+4]=uvec3(1,3,5)+uvec3(vindex);
|
||||
gl_PrimitiveTriangleIndicesEXT[pindex+5]=uvec3(3,5,7)+uvec3(vindex);
|
||||
}else{
|
||||
gl_PrimitiveTriangleIndicesEXT[pindex+4]=uvec3(0,2,4)+uvec3(vindex);
|
||||
gl_PrimitiveTriangleIndicesEXT[pindex+5]=uvec3(2,4,6)+uvec3(vindex);
|
||||
}
|
||||
}
|
||||
}
|
||||
+44
-7
@@ -52,7 +52,7 @@ layout(set=0,binding=11)restrict readonly buffer MatConst{
|
||||
mat4 mats[];
|
||||
}matconst;
|
||||
layout(set=0,binding=12)restrict readonly buffer DepInfo{
|
||||
uint8_t dependencies[2][];
|
||||
uint8_t dependencies[][2];
|
||||
}depinfo;
|
||||
|
||||
// unpack integers
|
||||
@@ -557,18 +557,55 @@ Description desc;
|
||||
|
||||
void pruneall (uint8_t pos) {
|
||||
uint8_t[2] deps;
|
||||
for (int i = 0; i < pos; i++)
|
||||
for (uint8_t i = uint8_t(0); i < pos; i++)
|
||||
{
|
||||
deps = depinfo.dependencies[desc.dependencies+i];
|
||||
if (deps[1] != 255) {
|
||||
//this is a dual output function (dup)
|
||||
//todo
|
||||
if ((deps[0] == pos) || (deps[1] == pos))
|
||||
{
|
||||
if ((mask[i>>3] & ~(1<<(i&7))) > 0)
|
||||
{
|
||||
mask[i>>3] &= uint8_t(~(1<<(i&7)));
|
||||
}
|
||||
else {
|
||||
pruneall(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (deps[0] == pos) {
|
||||
pruneall(i);
|
||||
}
|
||||
}
|
||||
mask[pos>>3] &= ~(1<<(pos&7));
|
||||
mask[pos>>3] &= uint8_t(~(1<<(pos&7)));
|
||||
}
|
||||
|
||||
void prunesome (uint8_t pos, bool prunemask[6]) {
|
||||
uint8_t[2] deps;
|
||||
int maskindex = 0;
|
||||
for (uint8_t i = uint8_t(0); i < pos; i++)
|
||||
{
|
||||
deps = depinfo.dependencies[desc.dependencies+i];
|
||||
if (deps[1] != 255) {
|
||||
if ((deps[0] == pos) || (deps[1] == pos))
|
||||
{
|
||||
if (prunemask[maskindex++]) {
|
||||
if ((mask[i>>3] & ~(1<<(i&7))) > 0)
|
||||
{
|
||||
mask[i>>3] &= uint8_t(~(1<<(i&7)));
|
||||
}
|
||||
else {
|
||||
pruneall(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (deps[0] == pos) {
|
||||
if (prunemask[maskindex++]) {
|
||||
pruneall(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
mask[pos>>3] &= uint8_t(~(1<<(pos&7)));
|
||||
}
|
||||
|
||||
#ifdef debug
|
||||
@@ -2748,12 +2785,12 @@ float[2]scene(vec3 p[2], bool prune)
|
||||
#ifdef debug
|
||||
vec3 sceneoverride(vec3 p, bool m)
|
||||
{
|
||||
return scene(vec3[2](p,p));
|
||||
return scene(vec3[2](p,p), false);
|
||||
}
|
||||
#else
|
||||
float sceneoverride(vec3 p, bool m)
|
||||
{
|
||||
return scene(vec3[2](p,p))[0];
|
||||
return scene(vec3[2](p,p), false)[0];
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user