Skip to content

Commit

Permalink
Fix shaders
Browse files Browse the repository at this point in the history
  • Loading branch information
nathan-baggs committed Aug 25, 2022
1 parent 5598f33 commit 421e3ea
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion shaders/glsl/vertex_node_chunk.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
vertex_pos{{swizzle}}
{% else if type == 1 %}
norm{{swizzle}}
{% else if type == 2%}
{% else if type == 2 %}
vec3(tex_coord{{swizzle}}, 0.0)
{% endif %}
6 changes: 4 additions & 2 deletions shaders/msl/texture_node_chunk.msl
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{% if vertex_data %}
{% if uv_source == 0 %}
texture_table[{{texture_index}}].texture.sample(sampler_table[{{sampler_index}}].smplr, in.tex.xy)
{% else %}
{% else if uv_source == 1 %}
texture_table[{{texture_index}}].texture.sample(sampler_table[{{sampler_index}}].smplr, in.position.xy * float2({{reciprocal_width}}, {{reciprocal_height}}))
{% else if uv_source == 2 %}
texture_table[{{texture_index}}].texture.sample(sampler_table[{{sampler_index}}].smplr, {{tex_coord}})
{% endif %}
4 changes: 3 additions & 1 deletion shaders/msl/vertex_node_chunk.msl
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{% if type == 0 %}
in.vertex_position{{swizzle}}
{% else %}
{% else if type == 1 %}
in.normal{{swizzle}}
{% else if type == 2 %}
float3(in.tex.xy, 0.0)
{% endif %}
2 changes: 1 addition & 1 deletion src/graphics/render_graph/shader_compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ void ShaderCompiler::visit(const ComponentNode &node)
const auto value = stream_stack_.top().str();
stream_stack_.pop();

const ::inja::json args{{"value", value, {"component", node.component()}}};
const ::inja::json args{{"value", value}, {"component", node.component()}};

stream_stack_.top() << ::inja::render(
language_string(language_, hlsl::component_node_chunk, glsl::component_node_chunk, msl::component_node_chunk),
Expand Down

0 comments on commit 421e3ea

Please sign in to comment.