Giter VIP home page Giter VIP logo

Comments (7)

RobDangerous avatar RobDangerous commented on August 16, 2024

From @romamik on August 15, 2016 13:46

So I made more simple example and found that the problem is in the agal code.

matrixwtf2.zip

GLSL source:

#version 100

attribute vec3 vertexPosition;
uniform mat4 projectionMatrix;

void kore() {
    gl_Position = projectionMatrix * vec4(vertexPosition, 1.0);
}

Generated ".vert.agal" file:

{
    "varnames": {
        "gl_Position": "vt0",
        "projectionMatrix": "vc0",
        "vertexPosition": "va0"
    },
    "consts": {
        "vc0": [0.5],
        "vc1": [0.5],
        "vc2": [0.5],
        "vc3": [0.5],
        "vc4": [1.0, 1.0, 1.0, 1.0]
    },
    "agalasm": "mov vt0, vc0\nmov vt1, vc1\nmov vt2, vc2\nmov vt3, vc3\nmov vt4, va0\nmov vt5, vt4.xxxx\nmov vt6, vt4.yyyy\nmov vt4, vt4.zzzz\nmov vt5.x, vt5.x\nmov vt5.y, vt6.y\nmov vt5.z, vt4.z\nmov vt5.w, vc4.w\nm44 vt0, vt5, vt0\nmov vt0, vt0\nadd vt1.xxxx, vt0.zzzz, vt0.wwww\nmul vt0.z, vc0.x, vt1.x\nmov op, vt0\n",
} 

And when I change agal to

    "agalasm": "m44 op,va0,vc0\n"

Everything begin to work correctly.

from krafix.

juakob avatar juakob commented on August 16, 2024

this is the agal generated code from the example:
mov vt0, vc0\n
mov vt1, vc1\n
mov vt2, vc2\n
mov vt3, vc3\n
mov vt4, va0\n
mov vt5, vt4.xxxx\n
mov vt6, vt4.yyyy\n
mov vt4, vt4.zzzz\n
mov vt5.x, vt5.x\n
mov vt5.y, vt6.y\n
mov vt5.z, vt4.z\n
mov vt5.w, vc4.w\n
m44 vt0, vt5, vt0\n
mov vt0, vt0\n
add vt1.xxxx, vt0.zzzz, vt0.wwww\n
mul vt0.z, vc0.x, vt1.x\n

mov op, vt0\n

if you remove the highlighted lines it works as expected. This lines are responsable for adjusting the clip space here . I dont understand why the z is adjusted using the w.
I don't have a 3d test were this line is actually important.

from krafix.

RobDangerous avatar RobDangerous commented on August 16, 2024

Clip space in z is 0 to w or -w to w depending on the 3D api. In Stage3D it's 0 to w according to the internet, in Kha it's -w to w. That calculation looks correct actually if vc0.x is 0.5, will have to do some tests.

from krafix.

juakob avatar juakob commented on August 16, 2024

Ok didnt know about the diferent clip spaces. Now I see what the problem is, vc0 is not 0.5, vc0 is the first row of the matrix, a matrix uses 4 registers in this case from vc0 to vc3. Dont worry, I will fix it.

from krafix.

RobDangerous avatar RobDangerous commented on August 16, 2024

Was this fixed by #40?

from krafix.

juakob avatar juakob commented on August 16, 2024

Yes, tested with the examples uploaded by @romamik.
PS. You need to delete the old agal generated code, or it wont generate the new one.

from krafix.

RobDangerous avatar RobDangerous commented on August 16, 2024

Cool Spot

from krafix.

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.