forked from suyu/suyu
HACK glsl: Write defaults to unused generic attributes
This commit is contained in:
parent
4b5a4ea72e
commit
14bfb4719a
2 changed files with 11 additions and 2 deletions
|
@ -110,8 +110,11 @@ EmitContext::EmitContext(IR::Program& program, Bindings& bindings, const Profile
|
||||||
header += fmt::format("layout(location={})out vec4 frag_color{};", index, index);
|
header += fmt::format("layout(location={})out vec4 frag_color{};", index, index);
|
||||||
}
|
}
|
||||||
for (size_t index = 0; index < info.stores_generics.size(); ++index) {
|
for (size_t index = 0; index < info.stores_generics.size(); ++index) {
|
||||||
if (info.stores_generics[index]) {
|
// TODO: Properly resolve attribute issues
|
||||||
header += fmt::format("layout(location={}) out vec4 out_attr{};", index, index);
|
const auto declaration{
|
||||||
|
fmt::format("layout(location={}) out vec4 out_attr{};", index, index)};
|
||||||
|
if (info.stores_generics[index] || stage == Stage::VertexA || stage == Stage::VertexB) {
|
||||||
|
header += declaration;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DefineConstantBuffers(bindings);
|
DefineConstantBuffers(bindings);
|
||||||
|
|
|
@ -209,6 +209,12 @@ std::string EmitGLSL(const Profile& profile, const RuntimeInfo& runtime_info, IR
|
||||||
ctx.header += "void main(){\n";
|
ctx.header += "void main(){\n";
|
||||||
if (program.stage == Stage::VertexA || program.stage == Stage::VertexB) {
|
if (program.stage == Stage::VertexA || program.stage == Stage::VertexB) {
|
||||||
ctx.header += "gl_Position = vec4(0.0f, 0.0f, 0.0f, 1.0f);";
|
ctx.header += "gl_Position = vec4(0.0f, 0.0f, 0.0f, 1.0f);";
|
||||||
|
// TODO: Properly resolve attribute issues
|
||||||
|
for (size_t index = 0; index < program.info.stores_generics.size() / 2; ++index) {
|
||||||
|
if (!program.info.stores_generics[index]) {
|
||||||
|
ctx.header += fmt::format("out_attr{}=vec4(0,0,0,1);", index);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
DefineVariables(ctx, ctx.header);
|
DefineVariables(ctx, ctx.header);
|
||||||
if (ctx.uses_cc_carry) {
|
if (ctx.uses_cc_carry) {
|
||||||
|
|
Loading…
Reference in a new issue