From cb111c1a73fa0b2168b2003120a002bc207bdeed Mon Sep 17 00:00:00 2001 From: quou Date: Thu, 2 Jan 2025 13:22:46 +1100 Subject: fix shader interpolator with no values --- sc/sc.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'sc/sc.cpp') diff --git a/sc/sc.cpp b/sc/sc.cpp index dfe4325..2bd1406 100644 --- a/sc/sc.cpp +++ b/sc/sc.cpp @@ -474,10 +474,12 @@ struct Desc { ss << attr.name << ";\n"; } } - ss << "layout (location = 0) out _Interpolator {\n"; - for (const auto& i : interp) - ss << i.tname << " " << i.name << ";\n"; - ss << "} interpolator;\n"; + if (interp.size()) { + ss << "layout (location = 0) out _Interpolator {\n"; + for (const auto& i : interp) + ss << i.tname << " " << i.name << ";\n"; + ss << "} interpolator;\n"; + } add_textures(ss, shader_type_vertex); add_cbuffers(ss, shader_type_vertex); return ss.str(); @@ -492,10 +494,12 @@ struct Desc { ss << attr.tname << " "; ss << attr.name << ";\n"; } - ss << "layout (location = 0) in _Interpolator {\n"; - for (const auto& i : interp) - ss << i.tname << " " << i.name << ";\n"; - ss << "} interpolator;\n"; + if (interp.size()) { + ss << "layout (location = 0) in _Interpolator {\n"; + for (const auto& i : interp) + ss << i.tname << " " << i.name << ";\n"; + ss << "} interpolator;\n"; + } add_textures(ss, shader_type_fragment); add_cbuffers(ss, shader_type_fragment); return ss.str(); -- cgit v1.2.3-54-g00ecf