Comments (7)
From @romamik on August 15, 2016 13:46
So I made more simple example and found that the problem is in the agal code.
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.
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.
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.
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.
Was this fixed by #40?
from krafix.
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.
Cool Spot
from krafix.
Related Issues (20)
- [linux + vulkan] using textureSize will create empty shader files HOT 7
- [linux + vulkan] Optimizer error HOT 4
- Compiling compute shader to metal -> texture bindings have the same index HOT 1
- Unable to access uniforms outside of main function in Metal HOT 1
- Unable to use multiple sampler uniforms HOT 3
- Unable to directly access vector uniform component for SPIRV
- Unable to set uniform of type int for SPIRV
- Wrong array lookup for uniform floats on generated HLSL HOT 8
- Unable to compile glsl into version 330 - Unknown identifier 'binding' in layout HOT 1
- Unable to build Kha apps from a system with glibc 2.27 HOT 2
- Vulkan textures broken HOT 3
- gl_VertexID broken on Vulkan HOT 6
- Error when using Krafix as a library on Linux.
- gl_InstanceID-based array-access in SPIR-V
- [HLSL] error X4500: overlapping register semantics not yet implemented
- Vulkan error when trying to compile a pipeline using attached shader HOT 1
- Enable dual shader compilation (high-/low-precision) for Android
- [spirv] Incorrect alignment for vec3 uniforms.
- Wrong output when using glsl `mat4` and compiling to SPIR-V HOT 1
- Metal Shader fails to compile on macos HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from krafix.