Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Bitwise OR operator in translator codegen frontend #233

Merged
merged 2 commits into from
Dec 26, 2024

Conversation

gjyotin305
Copy link
Contributor

@gjyotin305 gjyotin305 commented Dec 26, 2024

Summary

Add BITWISE_OR operator in translator codegen frontend.

Related Issue

closes #107

Changes

Shader Sample (Optional)

Example:

shader main {
    struct VSInput {
        vec2 texCoord @ TEXCOORD0;
    };
    struct VSOutput {
        vec4 color @ COLOR;
    };
    sampler2D iChannel0;
    vertex {
        VSOutput main(VSInput input) {
            VSOutput output;
            // Use bitwise AND on texture coordinates (for testing purposes)
            output.color = vec4(float(int(input.texCoord.x * 100.0) & 15), 
                                float(int(input.texCoord.y * 100.0) & 15), 
                                0.0, 1.0);
            return output;
        }
    }
    fragment {
        vec4 main(VSOutput input) @ gl_FragColor {
            // Simple fragment shader to display the result of the AND operation
            return vec4(input.color.rgb, 1.0);
        }
    }
}

Testing

I added two test cases one for metal and one for DirectX Backend

Checklist

  • Tests cover new or changed code (or reason why not)
  • Linked the issue with a closing keyword (if applicable)
  • Only touched files related to the issue
  • Everything builds and runs locally

@gjyotin305
Copy link
Contributor Author

@NripeshN PTAL

@NripeshN NripeshN closed this Dec 26, 2024
@NripeshN NripeshN reopened this Dec 26, 2024
@NripeshN NripeshN merged commit 748fded into CrossGL:main Dec 26, 2024
469 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add translator support for Bitwise OR token
2 participants