Skip to content

Commit

Permalink
More Godot 4.4 related fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
RodZill4 committed Dec 15, 2024
1 parent 8231721 commit ff608cc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
6 changes: 4 additions & 2 deletions addons/material_maker/engine/dependencies.gd
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,10 @@ func dependency_update(dependency_name : String, value = null, internal : bool =
var b : Buffer = buffers[dependency_name]
match b.status:
Buffer.Invalidated:
print_debug("Buffer %s (updating) should not be invalidated status" % dependency_name)
is_buffer_just_updated = true
#print_debug("Buffer %s (updating) should not be invalidated" % dependency_name)
#is_buffer_just_updated = true
update()
return
Buffer.UpdatingInvalidated:
#print_debug("Buffer %s (updating) reset to invalidated status" % dependency_name)
b.status = Buffer.Invalidated
Expand Down
2 changes: 1 addition & 1 deletion addons/material_maker/engine/nodes/gen_iterate_buffer.gd
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var iteration_param_name : String
var used_named_parameters : Array = []


func _ready():
func _init():
#texture.flags = Texture2D.FLAG_REPEAT
shader_computes.append(MMShaderCompute.new())
shader_computes.append(MMShaderCompute.new())
Expand Down
11 changes: 5 additions & 6 deletions addons/material_maker/map_generator/map_generator.gd
Original file line number Diff line number Diff line change
Expand Up @@ -149,15 +149,15 @@ static func generate(mesh : Mesh, map : String, size : int, texture : MMTexture)
mesh_pipeline.add_parameter_or_texture("iteration", "int", 1)
mesh_pipeline.add_parameter_or_texture("mode", "int", map_definition.mode)
await mesh_pipeline.set_shader(vertex_shader, fragment_shader)
print("Casting %d rays..." % ray_count)
print.call_deferred("Casting %d rays..." % ray_count)
for i in range(ray_count):
progress.set_progress.call_deferred(float(i)/ray_count)
mesh_pipeline.set_parameter("iteration", i+1)
mesh_pipeline.set_parameter("prev_iteration_tex", texture)
mesh_pipeline.in_thread_render(Vector2i(size, size), 3, texture)

if map == "bent_normals":
print("Normalizing...")
print.call_deferred("Normalizing...")
var normalize_pipeline : MMComputeShader = MMComputeShader.new()
normalize_pipeline.clear()
normalize_pipeline.add_parameter_or_texture("tex", "sampler2D", texture)
Expand All @@ -166,7 +166,7 @@ static func generate(mesh : Mesh, map : String, size : int, texture : MMTexture)

# Denoise
if true:
print("Denoising...")
print.call_deferred("Denoising...")
var denoise_pipeline : MMComputeShader = MMComputeShader.new()
denoise_pipeline.clear()
denoise_pipeline.add_parameter_or_texture("tex", "sampler2D", texture)
Expand All @@ -176,7 +176,7 @@ static func generate(mesh : Mesh, map : String, size : int, texture : MMTexture)

# Extend the map past seams
if pixels > 0 and map_definition.has("postprocess"):
print("Postprocessing...")
print.call_deferred("Postprocessing...")
#texture.save_to_file("d:/debug_x_%d.png" % debug_index)
debug_index += 1
for p in map_definition.postprocess:
Expand Down Expand Up @@ -214,15 +214,14 @@ static func get_map(mesh : Mesh, map : String, size : int = 2048, force_generate
if MAP_DEFINITIONS[map].has("dependencies"):
for d in MAP_DEFINITIONS[map].dependencies:
await get_map(mesh, d, size)
print("Creating map ", field_name, " for mesh ", mesh)
#print("Creating map ", field_name, " for mesh ", mesh)
while not mesh_maps[mesh].has(field_name):
if busy:
await mm_globals.get_tree().process_frame
else:
busy = true
var texture : MMTexture = MMTexture.new()
await mm_renderer.thread_run(generate, [mesh, map, size, texture])
print("generated texture ", texture)
mesh_maps[mesh][field_name] = texture
busy = false
return mesh_maps[mesh][field_name] as MMTexture

0 comments on commit ff608cc

Please sign in to comment.