mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-27 15:43:02 +00:00
Fix SDL compile failure when an image atomic's result is used (#2218)
This commit is contained in:
1 parent
b49d37d827
commit
3389b952d0
2 files changed
+34
No files matched your search
@@ -227,6 +227,11 @@ public final class RwImageStoreExtractor {
|
||||
final String firstArg = GlslAstHelpers.firstArgIdentifier(expr);
|
||||
if (!writtenImages.contains(firstArg)) continue;
|
||||
if (RW_CALLS.contains(fname)) {
|
||||
final ImageDecl d = declared.get(firstArg);
|
||||
if (d != null && !isCallTopLevelStatement(expr)) {
|
||||
edits.add(replaceOf(expr, scalarZeroFor(d.glslType())));
|
||||
continue;
|
||||
}
|
||||
final var stmt = GlslAstHelpers.enclosingOfType(expr, GLSLParser.StatementContext.class);
|
||||
if (stmt != null) edits.add(replaceOf(stmt, ";"));
|
||||
} else if ("imageLoad".equals(fname)) {
|
||||
@@ -378,6 +383,14 @@ public final class RwImageStoreExtractor {
|
||||
return "float";
|
||||
}
|
||||
|
||||
private static String scalarZeroFor(String glslType) {
|
||||
return switch (scalarFor(glslType)) {
|
||||
case "int" -> "0";
|
||||
case "uint" -> "0u";
|
||||
default -> "0.0";
|
||||
};
|
||||
}
|
||||
|
||||
private static String componentVecFor(String glslType) {
|
||||
if (glslType.startsWith("iimage")) return "ivec4";
|
||||
if (glslType.startsWith("uimage")) return "uvec4";
|
||||
|
||||
Reference in new issue
Block a user