Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
E
Efficient Realtime Rendering of Complex Closed Form Implicit Surfaces Using Modern RTX Enabled GPUs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
John Hunter
Efficient Realtime Rendering of Complex Closed Form Implicit Surfaces Using Modern RTX Enabled GPUs
Commits
a749c1e6
Unverified
Commit
a749c1e6
authored
2 years ago
by
John Hunter
Browse files
Options
Downloads
Patches
Plain Diff
start pruning code
parent
0420bf01
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/implicit.mesh.glsl
+44
-31
44 additions, 31 deletions
src/implicit.mesh.glsl
src/intervals.glsl
+27
-4
27 additions, 4 deletions
src/intervals.glsl
src/main.rs
+6
-6
6 additions, 6 deletions
src/main.rs
with
77 additions
and
41 deletions
src/implicit.mesh.glsl
+
44
−
31
View file @
a749c1e6
...
...
@@ -6,8 +6,8 @@
#include
"include.glsl"
#include
"intervals.glsl"
layout
(
local_size_x
=
1
,
local_size_y
=
1
,
local_size_z
=
1
)
in
;
layout
(
triangles
,
max_vertices
=
6
4
,
max_primitives
=
1
6
2
)
out
;
layout
(
local_size_x
=
32
,
local_size_y
=
1
,
local_size_z
=
1
)
in
;
layout
(
triangles
,
max_vertices
=
25
6
,
max_primitives
=
1
9
2
)
out
;
layout
(
location
=
0
)
out
VertexOutput
{
...
...
@@ -47,45 +47,58 @@ void main()
vec4
(
bounds
[
0
],
bounds
[
1
],
bounds
[
2
],
1
.),
};
SetMeshOutputsEXT
(
8
,
6
);
//This can be optimised
SetMeshOutputsEXT
(
256
,
192
);
mat4
mvp
=
camera_uniforms
.
proj
*
camera_uniforms
.
view
*
pc
.
world
;
uint
vindex
=
gl_LocalInvocationID
.
x
*
8
;
uint
pindex
=
gl_LocalInvocationID
.
x
*
6
;
//adjust scale and position
for
(
int
i
=
0
;
i
<
8
;
i
++
)
{
positions
[
i
]
*=
vec4
(
0
.
25
,
0
.
25
,
0
.
25
,
1
.);
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
[
0
].
gl_Position
=
mvp
*
(
positions
[
0
]);
gl_MeshVerticesEXT
[
1
].
gl_Position
=
mvp
*
(
positions
[
1
]);
gl_MeshVerticesEXT
[
2
].
gl_Position
=
mvp
*
(
positions
[
2
]);
gl_MeshVerticesEXT
[
3
].
gl_Position
=
mvp
*
(
positions
[
3
]);
gl_MeshVerticesEXT
[
4
].
gl_Position
=
mvp
*
(
positions
[
4
]);
gl_MeshVerticesEXT
[
5
].
gl_Position
=
mvp
*
(
positions
[
5
]);
gl_MeshVerticesEXT
[
6
].
gl_Position
=
mvp
*
(
positions
[
6
]);
gl_MeshVerticesEXT
[
7
].
gl_Position
=
mvp
*
(
positions
[
7
]);
vertexOutput
[
0
].
position
=
(
positions
[
0
]);
vertexOutput
[
1
].
position
=
(
positions
[
1
]);
vertexOutput
[
2
].
position
=
(
positions
[
2
]);
vertexOutput
[
3
].
position
=
(
positions
[
3
]);
vertexOutput
[
4
].
position
=
(
positions
[
4
]);
vertexOutput
[
5
].
position
=
(
positions
[
5
]);
vertexOutput
[
6
].
position
=
(
positions
[
6
]);
vertexOutput
[
7
].
position
=
(
positions
[
7
]);
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
[
gl_LocalInvocationI
ndex
+
0
]
=
uvec3
(
4
,
5
,
6
);
gl_PrimitiveTriangleIndicesEXT
[
gl_LocalInvocationI
ndex
+
1
]
=
uvec3
(
5
,
6
,
7
);
gl_PrimitiveTriangleIndicesEXT
[
pi
ndex
+
0
]
=
uvec3
(
4
,
5
,
6
)
+
uvec3
(
vindex
)
;
gl_PrimitiveTriangleIndicesEXT
[
pi
ndex
+
1
]
=
uvec3
(
5
,
6
,
7
)
+
uvec3
(
vindex
)
;
}
else
{
gl_PrimitiveTriangleIndicesEXT
[
gl_LocalInvocationI
ndex
+
0
]
=
uvec3
(
0
,
1
,
2
);
gl_PrimitiveTriangleIndicesEXT
[
gl_LocalInvocationI
ndex
+
1
]
=
uvec3
(
1
,
2
,
3
);
gl_PrimitiveTriangleIndicesEXT
[
pi
ndex
+
0
]
=
uvec3
(
0
,
1
,
2
)
+
uvec3
(
vindex
)
;
gl_PrimitiveTriangleIndicesEXT
[
pi
ndex
+
1
]
=
uvec3
(
1
,
2
,
3
)
+
uvec3
(
vindex
)
;
}
if
(
signingvec
.
y
>
0
){
gl_PrimitiveTriangleIndicesEXT
[
gl_LocalInvocationI
ndex
+
2
]
=
uvec3
(
2
,
3
,
6
);
gl_PrimitiveTriangleIndicesEXT
[
gl_LocalInvocationI
ndex
+
3
]
=
uvec3
(
7
,
3
,
6
);
gl_PrimitiveTriangleIndicesEXT
[
pi
ndex
+
2
]
=
uvec3
(
2
,
3
,
6
)
+
uvec3
(
vindex
)
;
gl_PrimitiveTriangleIndicesEXT
[
pi
ndex
+
3
]
=
uvec3
(
7
,
3
,
6
)
+
uvec3
(
vindex
)
;
}
else
{
gl_PrimitiveTriangleIndicesEXT
[
gl_LocalInvocationI
ndex
+
2
]
=
uvec3
(
0
,
1
,
4
);
gl_PrimitiveTriangleIndicesEXT
[
gl_LocalInvocationI
ndex
+
3
]
=
uvec3
(
5
,
1
,
4
);
gl_PrimitiveTriangleIndicesEXT
[
pi
ndex
+
2
]
=
uvec3
(
0
,
1
,
4
)
+
uvec3
(
vindex
)
;
gl_PrimitiveTriangleIndicesEXT
[
pi
ndex
+
3
]
=
uvec3
(
5
,
1
,
4
)
+
uvec3
(
vindex
)
;
}
if
(
signingvec
.
z
>
0
){
gl_PrimitiveTriangleIndicesEXT
[
gl_LocalInvocationI
ndex
+
4
]
=
uvec3
(
1
,
3
,
5
);
gl_PrimitiveTriangleIndicesEXT
[
gl_LocalInvocationI
ndex
+
5
]
=
uvec3
(
3
,
5
,
7
);
gl_PrimitiveTriangleIndicesEXT
[
pi
ndex
+
4
]
=
uvec3
(
1
,
3
,
5
)
+
uvec3
(
vindex
)
;
gl_PrimitiveTriangleIndicesEXT
[
pi
ndex
+
5
]
=
uvec3
(
3
,
5
,
7
)
+
uvec3
(
vindex
)
;
}
else
{
gl_PrimitiveTriangleIndicesEXT
[
gl_LocalInvocationI
ndex
+
4
]
=
uvec3
(
0
,
2
,
4
);
gl_PrimitiveTriangleIndicesEXT
[
gl_LocalInvocationI
ndex
+
5
]
=
uvec3
(
2
,
4
,
6
);
gl_PrimitiveTriangleIndicesEXT
[
pi
ndex
+
4
]
=
uvec3
(
0
,
2
,
4
)
+
uvec3
(
vindex
)
;
gl_PrimitiveTriangleIndicesEXT
[
pi
ndex
+
5
]
=
uvec3
(
2
,
4
,
6
)
+
uvec3
(
vindex
)
;
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/intervals.glsl
+
27
−
4
View file @
a749c1e6
...
...
@@ -6,6 +6,7 @@
#include
"instructionset.glsl"
const
float
INFINITY
=
1
.
/
0
.;
const
float
NINFINITY
=
(
-
1
.)
/
0
.;
struct
Description
{
uint
scene
;
...
...
@@ -16,6 +17,7 @@ struct Description{
uint
mat2s
;
uint
mat3s
;
uint
mat4s
;
uint
dependencies
;
};
layout
(
set
=
0
,
binding
=
2
)
restrict
readonly
buffer
SceneDescription
{
...
...
@@ -49,6 +51,9 @@ layout(set=0,binding=10)restrict readonly buffer Mat4Const{
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
][];
}
depinfo
;
// unpack integers
#define get_caches u32vec4 major_unpack=scenes.opcodes[major_position+desc.scene];\
...
...
@@ -548,10 +553,28 @@ void default_mask()
in1[1]=trunc(in1[1]);\
}
Description
desc
;
void
pruneall
(
uint8_t
pos
)
{
uint8_t
[
2
]
deps
;
for
(
int
i
=
0
;
i
<
pos
;
i
++
)
{
deps
=
depinfo
.
dependencies
[
desc
.
dependencies
+
i
];
if
(
deps
[
1
]
!=
255
)
{
//this is a dual output function (dup)
//todo
}
else
if
(
deps
[
0
]
==
pos
)
{
pruneall
(
i
);
}
}
mask
[
pos
>>
3
]
&=
~
(
1
<<
(
pos
&
7
));
}
#ifdef debug
vec3
scene
(
vec3
p
[
2
])
vec3
scene
(
vec3
p
[
2
]
,
bool
prune
)
#else
float
[
2
]
scene
(
vec3
p
[
2
])
float
[
2
]
scene
(
vec3
p
[
2
]
,
bool
prune
)
#endif
{
uint
major_position
=
0
;
...
...
@@ -559,7 +582,7 @@ float[2]scene(vec3 p[2])
uint
minor_integer_cache
[
8
];
Description
desc
=
scene_description
.
desc
[
gl_GlobalInvocationID
.
x
];
desc
=
scene_description
.
desc
[
gl_GlobalInvocationID
.
x
];
clear_stacks
();
push_vec3
(
p
);
...
...
@@ -1219,7 +1242,7 @@ float[2]scene(vec3 p[2])
float
[
2
]
in1
=
pull_float
(
ifconst
(
0
));
if
(
floor
((
in1
[
0
]
/
PI
))
==
floor
((
in1
[
1
]
/
PI
)))
{
in1
[
0
]
=
-
INFINITY
;
in1
[
0
]
=
N
INFINITY
;
in1
[
1
]
=
INFINITY
;
}
else
{
...
...
This diff is collapsed.
Click to expand it.
src/main.rs
+
6
−
6
View file @
a749c1e6
...
...
@@ -602,12 +602,12 @@ fn main() {
let
mut
data
=
[[
0u32
;
4
];
29
];
let
parts
=
vec!
[
CSGPart
::
opcode
(
InstructionSet
::
OPDupVec3
,
0b000000
),
CSGPart
::
opcode
(
InstructionSet
::
OPSubVec3Vec3
,
0b010000
),
//
CSGPart::opcode(InstructionSet::OPDupVec3, 0b000000),
//
CSGPart::opcode(InstructionSet::OPSubVec3Vec3, 0b010000),
CSGPart
::
opcode
(
InstructionSet
::
OPSDFSphere
,
0b100000
),
CSGPart
::
opcode
(
InstructionSet
::
OPAddVec3Vec3
,
0b010000
),
CSGPart
::
opcode
(
InstructionSet
::
OPSDFSphere
,
0b100000
),
CSGPart
::
opcode
(
InstructionSet
::
OPSmoothMinFloat
,
0b000000
),
//
CSGPart::opcode(InstructionSet::OPAddVec3Vec3, 0b010000),
//
CSGPart::opcode(InstructionSet::OPSDFSphere, 0b100000),
//
CSGPart::opcode(InstructionSet::OPSmoothMinFloat, 0b000000),
CSGPart
::
opcode
(
InstructionSet
::
OPStop
,
0b000000
),
];
...
...
@@ -828,7 +828,7 @@ fn main() {
.into
();
builder
.push_constants
(
implicit_pipeline
.layout
()
.clone
(),
0
,
push_constants
)
.draw_mesh
([
1
,
1
,
1
])
.draw_mesh
([
1
,
1
,
2
])
.unwrap
();
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment