Skip to content

Commit

Permalink
More work on functions
Browse files Browse the repository at this point in the history
  • Loading branch information
MCRcortex committed Oct 16, 2023
1 parent a05e66e commit 2dcf9c9
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import me.cortex.vulkanite.client.rendering.srp.graph.resource.Resource;

import java.util.*;
import java.util.stream.Collectors;

public class RenderGraph implements VirtualResourceMapper {
private final Reference2ObjectMap<Pass<?>, Set<Pass<?>>> dependents = new Reference2ObjectOpenHashMap<>();
Expand Down Expand Up @@ -112,4 +113,17 @@ private void topologicalSort0(Set<Pass<?>> seen, Pass<?> current, int depth, Lis

sort.add(current);
}

@Override
public String toString() {
String out = "Execution Ordering:\n";
for (var pass : this.ordering) {
out += "- " + pass.name() + " uses: " + pass.uses().stream().map(a->a.name()==null? a.getClass().getTypeName():a.name()).collect(Collectors.joining(", "))+"\n";
}
out += "All used resources:\n";
for (var resource : this.graphResources) {
out += "- " + (resource.name() == null?resource.getClass().getTypeName():resource.name()) + "\n";
}
return out;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ private void addConstants(LuaValue env) {
env.set("SHADER_RAY_CHIT", VK_SHADER_STAGE_CLOSEST_HIT_BIT_KHR);
env.set("SHADER_RAY_AHIT", VK_SHADER_STAGE_ANY_HIT_BIT_KHR);
env.set("SHADER_RAY_INTER", VK_SHADER_STAGE_INTERSECTION_BIT_KHR);
env.set("SHADER_COMPUTE", VK_SHADER_STAGE_COMPUTE_BIT);

env.set("ACCESS_READ", ACCESS_READ);
env.set("ACCESS_WRITE", ACCESS_WRITE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,9 @@ private static List<List<Resource<?>>> generateBindingList(LuaTable bindingArray

public LuaValue RaytracePass(LuaValue arg) {
var pass = new TracePass(((LuaJObj<TracePipeline>)arg.get("pipeline")).get(), ()-> new Vector3i(ExecutionConstants.INSTANCE.getScreenSize(), 1));

if (arg.get("name") != LuaValue.NIL) {
pass.name(arg.get("name").checkjstring());
}
var bindingTable = arg.get("sets").checktable();
for (int index = 1; index < bindingTable.keyCount()+1; index++) {
var bindingSetObject = bindingTable.get(index);
Expand All @@ -237,7 +239,9 @@ public LuaValue RaytracePass(LuaValue arg) {

public LuaValue ComputePass(LuaValue arg) {
var pass = new ComputePass(((LuaJObj<ComputePipeline>)arg.get("pipeline")).get(), ()-> new Vector3i(ExecutionConstants.INSTANCE.getScreenSize(), 1));

if (arg.get("name") != LuaValue.NIL) {
pass.name(arg.get("name").checkjstring());
}
var bindingTable = arg.get("sets").checktable();
for (int index = 1; index < bindingTable.keyCount()+1; index++) {
var bindingSetObject = bindingTable.get(index);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public static void main(String[] args) throws InterruptedException {
System.err.println("Done");
Thread.sleep(1000);
Vulkanite.INSTANCE.destroy();
System.err.println(host.getGraph());
System.gc();
}
}
2 changes: 1 addition & 1 deletion src/main/java/me/cortex/vulkanite/lib/shader/VShader.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static VShader compileLoad(VContext ctx, ByteBuffer spirv, int stage) {
}

public static VShader compileLoad(VContext ctx, String source, int stage) {
return compileLoad(ctx,ShaderCompiler.compileShader("shader", source, stage), stage);
return compileLoad(ctx, ShaderCompiler.compileShader("shader", source, stage), stage);
}

@Override
Expand Down

0 comments on commit 2dcf9c9

Please sign in to comment.