Giter Club home page Giter Club logo

hxsl's People

Contributors

aduros avatar ncannasse avatar rezmason avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hxsl's Issues

Cannot merge back :)

Because haxelib's format is not up to sync for format.agal...

Can you please release a new format version ?

thx

why not m33 ,now it is dp3

Test2.hx:20: vertex:
mov t0.xyz, c4.xxx
dp3 t1.x, t0.xyz, c0
dp3 t1.y, t0.xyz, c1
dp3 t1.z, t0.xyz, c2
mov out, t1.xyzz
fragment:
mov out, c0.xxxx

Problem with array M44<20>

In hxsl 1 this shader worked ok, now strange problem

class Batch2DShader extends Shader
{
    static var SRC = {
        var input : {
            pos : Float2,
            uv: Float2,
            index:Float
        };

        var tuv:Float2;
        var cTrans:Float4;
        var pWrap:Param<Bool>;
        var pFilter:Param<Bool>;
        var pMipmap:Param<Bool>;

        function vertex(mproj:Matrix, mpos:M44<20>, cTransArr:Float4<20>, regions:Float4<20>)
        {
            // http://code.google.com/p/hxformat/issues/detail?id=28#c8
            //var i = input.pos.xyzw;
            //i.x = input.index.x * 4;
            //out = input.pos.xyzw * mpos[i.x] * mproj;
            out = input.pos.xyzw * mpos[input.index * 4] * mproj;

            var region = regions[input.index];
            tuv = input.uv * region.zw + region.xy;
            cTrans = cTransArr[input.index];
        }

        function fragment(tex:Texture)
        {
            out = tex.get(tuv, wrap=pWrap, filter=pFilter, mipmap=pMipmap) * cTrans;
        }
    };
}

3.2 rc-2 with static analyzer gives RuntimeCompiler error

I try to compile a Flambe project using the new -D analyzer, but I now get this error:

C:\HaxeToolkit\haxe\lib\hxsl/2,0,3/hxsl/RuntimeCompiler.hx:573: characters 17-20 : Unbound variable _g

Not sure if this is a Haxe or HXSL error.

Compilation error

I trying to compile HxSL with latest nightly version of 3.1.0 compiler and got an error:

 /Users/fomkin/repos/thirdparty/hxsl/src/main/haxe/hxsl/Shader.hx:95: characters 11-12 : Unmatched patterns: TArray(_,_)

Shader.unbind doesn't unbind textures

In the file Shader.hx in the method unbind on line 321 at says:

ctx.setTextureAt(k, i.textures[k]);

After modify that line to:

ctx.setTextureAt(k, null);

the method unbind works as expected.

multiple texture usage in hxsl

I write fragment func like this
function fragment(tex0:Texture, tex1:Texture, tex2:Texture, tex3:Texture)

but the problem is I don't the exact number of textures will used here

currently I uploaded 8 tex with some empty bitmapdata textures

but in agal I can dynamically make the agal opcode string to achieve this
for (var x:int;i < textureCount;i++){
"tex " + ftColor + "," + + "," + fsList[i] + "<2d,repeat,miplinear,linear>",
}

The thing I wanna achieve is similar like this:
http://blog.flash-core.com/?p=493

here's the google group thread
https://groups.google.com/forum/#!topic/haxelang/CF4ibEta5x4

Matrix multiplication (+ small Camera problem)

Hi,
Here a big and a small problem.
The big one is about matrix multiplication.
To make an application targeting AS3, I took the example 2_texture as a base. As I wanted the projection matrix to affect the direction of the light (It was a mistake, but it doesn't matter here), so I replaced:
function vertex( mpos : M44, mproj : M44, light : Float3 ) {
out = input.pos.xyzw * mpos * mproj;
var tnorm = (input.norm * mpos).normalize();
lpow = light.dot(tnorm).max(0);
tuv = input.uv;
}
by
function vertex( mpos : M44, mproj : M44, light : Float3 ) {
out = input.pos.xyzw * mpos * mproj;
var tnorm = (input.norm * mpos * mproj).normalize();
lpow = light.dot(tnorm).max(0);
tuv = input.uv;
}
then I wanted to optimize by putting mpos_mproj in an variable, so I changed it for:
function vertex( mpos : M44, mproj : M44, light : Float3 ) {
var mposproj:M44 = mpos_mproj;
out = input.pos.xyzw * mposproj;
var tnorm = (input.norm * mposproj).normalize();
lpow = light.dot(tnorm).max(0);
tuv = input.uv;
}
and got an error on mpos_mproj:
M44 should be M44
I changed mposproj declaration for:
var mposproj = mpos_mproj;
and then got an error on input.pos.xyzw * mposproj:
M44 should be Float4

The small problem come with the Camera class that is given with the examples.
As the X,Y,Z vectors in Stage3D form a left-hand frame (see http://www.adobe.com/devnet/flashplayer/articles/3d-cameras.html) with X axis to right, Y to up and Z to front, the resulting projection matrix of Camera class comes reversing bottom and up.
In my case, I solved the problem replacing line 44:
var ay = az.cross(ax);
by
var ay = ax.cross(az);
It solved the problem with AS3 but it could cause it for other platforms. Maybe a better solution could be fine using precompilation instructions.

Reassing realType

Now realtypes are fixed in Build.hx

Will be great call something

Build.setRealType(TFloat3, "my.math.Float3");

Cannot compile the code

hi, ncannasse

Cannot compile the code.

You can provide h3d and hxsl under the haxe2.10 version?

thanks

D:\OpenSource\hxsl>haxe hxsl.hxml
hxsl/AgalCompiler.hx:724: characters 26-40 : Identifier 'TIgnoreSampler' is not
part of enum format.agal.TexFlag
hxsl/AgalCompiler.hx:724: characters 26-40 : For function argument 'x'
hxsl/AgalCompiler.hx:724: characters 26-40 : Identifier 'TIgnoreSampler' is not
part of enum format.agal.TexFlag
hxsl/AgalCompiler.hx:724: characters 26-40 : For function argument 'x'

the bug of the array fragmentVars

thanks.

where the .1,.2,.3?

package ; import flash.display.Sprite; import flash.geom.Vector3D; import hxsl.Shader; class TestShader extends Shader { static var SRC = { var lights:Param <{ var lights:Array<{position:Float3}>; }>; function vertex() { out = [1, 1, 1, 1]; } function fragment() { var color:Float4 = [0,0,0,0]; for (light in lights.lights) { color.xyz += light.position; } out = color; } } } class TestHxsl extends Sprite { public static function main():Void { var shader = new TestShader(); shader.lights = { lights:[ {position:new Vector3D(.1, .2, .3) } ] }; var shaderInstance = shader.getInstance(); trace(shader.getDebugShaderCode(true)); trace(shaderInstance.fragmentVars); }

}

output
TestHxsl.hx:32: vertex:
mov out, c0.xxxx
fragment:
mov t0, c1.xxxx
add t0.xyz, t0.xyz, c0.xyz
mov out, t0
TestHxsl.hx:33: 0,0,0,0,0,1,1,1

Publish to haxelib

It would be great if HXSL was available on haxelib, so that it can be specified as a dependency.

Untyped ALL array

Now I see this error

C:\HaxeToolkit\haxe\lib/hxsl/2,0,0/hxsl/Shader.hx:308: characters 13-24 : You can't iterate on a Dynamic value, please specify Iterator or Iterable
C:\HaxeToolkit\haxe\lib/hxsl/2,0,0/hxsl/Shader.hx:136: characters 11-15 : hxsl.ShaderGlobals should be { instances : Map<Unknown<0>, Unknown<1>> }
C:\HaxeToolkit\haxe\lib/hxsl/2,0,0/hxsl/Shader.hx:136: characters 11-15 : The field instances is not public
C:\HaxeToolkit\haxe\lib/hxsl/2,0,0/hxsl/Shader.hx:136: characters 11-15 : For function argument 'x'

FIX: static var ALL:Array = new Array();

It does not seem tow ork with haxe3?

Hi

I just downloaded the lib and the samples, and I cannot compile them,. Is it that this is not compatible with H3?

haxe -cp ../lib -swf C:/DEVEXAMPLES/haxe3/hxsl/samples/0_cube/test.swf -swf-header 800:600:60:FFFFFF --flash-strict -swf-version 11 -main Test -lib hxsl
Test.hx:13: characters 9-12 : Unknown variable 'pos'
c:\DEVTOOLS\HAXE\haxe\lib/hxsl/git/hxsl/Shader.hx:322: characters 2-11 : Build failure
Build halted with errors (haxe.exe

thanks

Build error

hxsl/Parser.hx:516: characters 7-13 : This constructor is not part of the enum haxe.macro.ExprDef

after fix this bug

haxe hxsl.hxml
hxsl/RuntimeCompiler.hx:508: characters 3-49 : Invalid field access : length
hxsl/RuntimeCompiler.hx:549: characters 9-35 : Called from
hxsl/RuntimeCompiler.hx:540: characters 12-19 : Called from
hxsl/RuntimeCompiler.hx:566: characters 37-44 : Called from
hxsl/RuntimeCompiler.hx:257: characters 35-42 : Called from
hxsl/RuntimeCompiler.hx:171: characters 3-32 : Called from
hxsl/RuntimeCompiler.hx:70: characters 11-24 : Called from
test/Main.hx:28: characters 9-57 : Called from
test/Main.hx:41: characters 7-20 : Called from
test/Main.hx:40: characters 2-5 : Called from
test/Main.hx:129: lines 129-145 : Called from
Aborted

Mac os 10.7.3

$ haxe 
Haxe Compiler 2.10 - (c)2005-2012 Motion-Twin
haxelib info format
Name: format
Tags: abc, amf, cross, flv, gz, mp3, pbj, pdf, swf, tar, zip
Desc: A haXe Library for supporting different file formats.
Website: http://code.google.com/p/hxformat
License: BSD
Owner: ncannasse
Version: 1.23.2

error in max constants determination

Build.hx file (line 117)

if( vcount >> 2 >= format.agal.Tools.getProps(RConst, !shader.vertex).count )

Must be:

if( vcount >> 2 > format.agal.Tools.getProps(RConst, !shader.vertex).count )

We have 128 registers, not 127.

texture flags as parameters

Something like

var uv:Float2;

function fragment(data:TextureFlags, tex:Texture2D)
{
  out = tex.get(uv, data);
}

If / Float / Bool problem

Hi,

I noticed a Float/Bool conversion problem while trying to test an expression such as:
if ( xxx > 0.5) doSomething;
xxx being a Float

Compiler gives: "Float should be Bool" for the expression "xxx > 0.5"

The problem is that comparison operations between Float return a Float which value is 0 or 1 but if test requires a Bool and there is no conversion.

It seems to occurs in Compiler.hx when on line 206 is called "unify(cond.t, TBool, e.p);"
unify calls tryUnify which throws that error.

I also noticed that expressions such as if (aConstant == null) or if (aConstant!=null) do compile as they seem to return a Bool.

I presume that that exception is linked with the lines 801-817 of Compiler.hx, in the makeOp method.
That block starts with the comment: // if we have a null check, infer a VParam

On line 76, I tried to replace:
case CMin, CMax, CLt, CGte, CEq, CNeq, CLte, CGt: floats;
By:
case CMin, CMax: floats;
case CLt, CGte, CEq, CNeq, CLte, CGt: [ { p1 : TFloat4, p2 : TFloat4, r : TFloat4}, { p1 : TFloat3, p2 : TFloat3, r : TFloat3}, { p1 : TFloat2, p2 : TFloat2, r : TFloat2} , { p1 : TFloat, p2 : TFloat, r : TBool } ];
My shader compiled but failed at runtime.

I also tried to put in tryUnify, after the line 740:
case TFloat: return (t2 == TFloat || t2 == TBool);
but I had the same result. It compiled but failed at runtime.

Thank you for your work,
Olivier.

Unknown identifier : VParam

I've got this when I try to run samples:

C:\Motion-Twin\Haxe\lib\hxsl/2,0/hxsl/Shader.hx:145: characters 17-23 : Unknown identifier : VParam

When I change:

Shader.hx line 26

from: import hxsl.Data.Tools;

to: import hxsl.Data;

samples worked.

What is my problem?

Recent hxformat release breaks hxsl

/home/bruno/.haxe/lib/hxsl/2,0,3/hxsl/AgalCompiler.hx:178: lines 178-181 : Object requires field version
/home/bruno/.haxe/lib/hxsl/2,0,3/hxsl/AgalCompiler.hx:120: lines 120-182 : Missing return format.agal.Data

This breaks new Flambe installs and anything else that depends on hxsl. :(

Do you think you could explicitly specify the dependency version in haxelib.json to prevent this from happening again in the future?

m44[1]

class TestShader extends Shader {
var SRC = {
var matr:M44;
function vertex() {
out = [1, 1, 1, 1]*matr[0];
}

    function fragment() {
        out = [1,1,1,1];
    }
};

}

PicoShader multiple compilation errors

class PicoBuild {
macro public
// remove @ before macro

var decls = ["override function getData() return '"+s+"';",];
// add ";" at end

at PicoShaderInstance
for ( v in data.vars ) {
// replace with
var allVars = Tools.getAllVars(data);
for ( v in allVars ) {

Looks like Pico*-branch not supported?

bind multi vertexbuffer instance

It seems I have to combine all vertexbuffer to one,and call shader.bind(buf)?

How I wish I could do this:
shader.bind(buf1,buf2,buf3)...

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.