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

material properties only work with direct assignment (=) but not with compound-assignment (e.g.: *=) #7914

Open
gibssa opened this issue Jun 8, 2024 · 3 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request low priority Low priority issue materials Issue/request for the material system

Comments

@gibssa
Copy link

gibssa commented Jun 8, 2024

Describe the bug
clipSpaceTransform won't compile at all in matc for a vertexDomain:device shader (docs, previous discussion).

To Reproduce

  1. git clone [email protected]:google/filament.git
  2. ./build.sh release matc
  3. Minimal shader test_direct_pixels.mat:
material {
    name: TestDirectPixels,
    parameters: [
    ],
    requires : [
        uv0
    ],
    blending : transparent,
    vertexDomain : device,
    shadingModel : unlit
}

vertex {
    void materialVertex(inout MaterialVertexInputs material) {
        material.clipSpaceTransform *= 0.3;
    }
}

fragment {
    void material(inout MaterialInputs material) {
        prepareMaterial(material);
        vec2 uv = getUV0();
        material.baseColor = float4(0.0, 0.1, 0.4, 0.4);
    }
}

  1. ./out/cmake-release/tools/matc/matc --api=metal --platform=mobile --output=./test_direct_pixels.filamat ./test_direct_pixels.mat
  2. matc compilation fails:
➜  filament git:(main) ✗ ./out/cmake-release/tools/matc/matc --api=metal --platform=mobile --output=./test_direct_pixels.filamat ./test_direct_pixels.mat
ERROR: Unable to parse vertex shader
ERROR: test_direct_pixels.mat:15: 'clipSpaceTransform' : no such field in structure 'material'
ERROR: test_direct_pixels.mat:15: '' : compilation terminated
ERROR: 2 compilation errors.  No code generated.


Could not compile material ./test_direct_pixels.mat

Expected behavior
matc compilation should work, though it may have broken here?

Screenshots
N/A

Logs
(see Step 6 above)

Desktop (please complete the following information):

  • OS: macOS
  • GPU: MacBook Pro Nov 2023
  • Backend: Metal

Smartphone (please complete the following information):

  • Device: N/A (offline matc)
  • OS: N/A (offline matc)

Additional context
I'm looking to create a 2D quad, with 256 instances, and do efficient vertex transforms on the GPU.

Thanks as always team!

@pixelflinger pixelflinger self-assigned this Jun 10, 2024
@pixelflinger pixelflinger added the bug Something isn't working label Jun 10, 2024
@pixelflinger
Copy link
Collaborator

note that

test_filamat --gtest_filter=\*.StaticCodeAnalyzerDirectAssignVertex

passes

@pixelflinger
Copy link
Collaborator

pixelflinger commented Jun 10, 2024

ah this looks like a bug in how we detect when a property is used. Currently you can't use *= you have to use =. It shouldn't be a problem because it's set to identity by default.

@pixelflinger pixelflinger added materials Issue/request for the material system low priority Low priority issue labels Jun 10, 2024
@pixelflinger pixelflinger changed the title clipSpaceTransform broken in matc material properties only work with direct assignment ('=') but not with compound-assignment (e.g.: *=) Jun 10, 2024
@pixelflinger pixelflinger changed the title material properties only work with direct assignment ('=') but not with compound-assignment (e.g.: *=) material properties only work with direct assignment (=) but not with compound-assignment (e.g.: *=) Jun 10, 2024
@pixelflinger pixelflinger added the enhancement New feature or request label Jun 10, 2024
@gibssa
Copy link
Author

gibssa commented Jun 11, 2024

ah this looks like a bug in how we detect when a property is used. Currently you can't use *= you have to use =. It shouldn't be a problem because it's set to identity by default.

Works! Thank you for the triage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request low priority Low priority issue materials Issue/request for the material system
Projects
None yet
Development

No branches or pull requests

2 participants