graphicsfuzz
graphicsfuzz copied to clipboard
Transformation idea: vector access like .x to [0]
Hi i want to solve this good first issue please guide me through
Sure.
OpaqueExpressionGenerator.java has a field:
private final List<ExpressionIdentity> expressionIdentities;
An ExpressionIdentity is a class that knows how to turn an expression e into an equivalent expression e'. In this case we want to turn "v.x", where "v" is a vector, into "v[0]" (and similarly for other components).
Lines 72 onwards in OpaqueExpressionGenerator feature statements like:
expressionIdentities.add(new IdentityAddSubZero());
expressionIdentities.add(new IdentityMulDivOne());
expressionIdentities.add(new IdentityAndTrue());
expressionIdentities.add(new IdentityOrFalse());
expressionIdentities.add(new IdentityLogicalNotNot());
expressionIdentities.add(new IdentityTernary());
You would want to add something like:
expressionIdentities.add(new IdentityVectorComponent());
Then, lower in the class, you would need to write the IdentityVectorComponent
class.
Have a look at other classes in the file, such as IdentityOrFalse, for inspiration.
In your case you will need to override preconditionHolds
to check that the expression being considered for transformation is a MemberLookupExpr. Then, in apply
, you'll need to inspect which field of the vector is being accessed, and replace the expression with an ArrayIndexExpr that uses the appropriate index.
Hope this helps you get started.
Hey, I read this code May, I contribute?
shivani please let me work on this code ..... this is my first time ever a little experience will help me :))
shivani please let me work on this code ..... this is my first time ever a little experience will help me :))
Okay , No problem 🙂
hi there ... i was setting up this project via setup process given in the repository and i am stuck at the step--- activating the virtual environment please help me on this step
how to proceed from start ?? please help
@shubhav99 Can you explain in detail what the problem is that you are facing? What did you try and what error messages are you getting?
sir i want to work on this issue , from where can i start?
sir i am stuck in the return statement of this issue , can you help me out?
sir in the return statement i need to return ArrayIndexExpr ?? like this return ArrayIndexExpr(Expr array, Expr index) {
// vec2 v;
// v[0]; // fine
// v + vec2(0.0)[0]; // not fine - the following was probably intended:
// (v + vec2(0.0))[0]; // fine
if (array instanceof BinaryExpr) {
throw new IllegalArgumentException("Array index into binary expression "
+ array.getText() + " not allowed.");
}
this.array = array;
this.index = index;
}
Hello sir, Can I work on this issue?
hello i am a beginner in this issue,could you please tell me how to get started