Giter Club home page Giter Club logo

Comments (5)

tangent-vector-personal avatar tangent-vector-personal commented on May 10, 2024

Can you copy-paste in the error message you see?

My guess is that I'm just missing some overloads of operator*. I hope it isn't something more serious.

from slang.

tangent-vector-personal avatar tangent-vector-personal commented on May 10, 2024

One more note-to-self issue here is that I'm realizing there could be subtle problems if cross-compilation involves scalar-to-matrix conversion. float4x4(a) produces a matrix with 16 elements of a, while mat4(a) produces a diagonal matrix.

There is a similar issue where I need to make sure to translate HLSL operator* on matrices to the appropriate componentMul call.

from slang.

nbentyNV avatar nbentyNV commented on May 10, 2024

image

from slang.

tangent-vector avatar tangent-vector commented on May 10, 2024

I think I misunderstood this error. The problem is not that we are giving an error on a matrix-scalar multiply in GLSL code, but rather that we are giving the error on Slang code that tries to do matrix-times-scalar.

It seems like this error shouldn't be specific to cross-compilation, then, and should occur for any Slang code that tries to do this.

from slang.

tangent-vector avatar tangent-vector commented on May 10, 2024

Yep. I can repro this is a bare Slang file, so this is just a plain old screw-up on my part.

There are two reasonable ways to fix this:

  • Implement implicit promotion of scalars to matrices, after which the ordinary component-wise multiply will be taken
  • Implement explicit overloads of operator* (and probably others) for the matrix/scalar and scalar/matrix cases (and same for vector/scalar, ...)

It isn't clear to me which is the way that HLSL interprets this kind of things internally.

from slang.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.