[Haskell-cafe] ANN: GPipe-Collada - Collada for Haskell!

2010-04-21 Thread Tobias Bexelius

Hi,

 

I've uploaded GPipe-Collada-0.1.0 to hackage 
(http://hackage.haskell.org/package/GPipe-Collada-0.1.0) that enables you to 
load Collada files to be used with GPipe.

 

Check out Graphics.GPipe.Collada.Utils.viewScene for an example on how to use 
loaded Collada scenes 
(http://hackage.haskell.org/packages/archive/GPipe-Collada/0.1.0/doc/html/Graphics-GPipe-Collada-Utils.html#5).
 

 

For more information regarding Collada, including free sample files, visit 
http://www.collada.org.

 

 

Cheers!

Tobias
  
_
Surfa tryggt med Internet Explorer 8
http://www.microsoft.com/sverige/windows/internet-explorer/default.aspx___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] ANN: GPipe-1.1.0 with greatly improved performance

2009-11-22 Thread Tobias Bexelius

Hi,

 

GPipe 1.1.0 is now available on Hackage. This update includes the following:

 

* BIG performance increase:

 

The previous shader cache keys grew exponential in size in relation to the 
GPipe program. This is now fixed with a completely new shader generator so the 
cache key sizes are linear relative to the program. In addition, the cache now 
uses patricia trees instead of an ordinary map, which will be a big performance 
win in programs with many shaders. In the simple example on 
http://www.haskell.org/haskellwiki/GPipe I got an performance increase of 
factor 2.7(!), and expect it to be even larger for more complex programs.

 

 

* Other minor fixes:

 

Fixed so min, max, abs and sign no longer works on Vertex Int and Fragment Int 
types, since its not supported in GLSL 1.20.

 

Reexport of Vec-Boolean instances so you dont need to import that package on 
its own any more.

 

Added IfB instances for the associated type Color.

 

 

Cheers

Tobias
  
_
Nya Windows 7 gör allt lite enklare. Hitta en dator som passar dig!
http://windows.microsoft.com/shop___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] RE: ANN: GPipe-TextureLoad 1.0.0 and GPipe 1.0.3

2009-10-27 Thread Tobias Bexelius

I accidently missed a spot in the latest GPipe bugfix, this is fixed in version 
1.0.4 that I've just uploaded. Sorry for that.

 

/Tobias Bexelius

 


From: tobias_bexel...@hotmail.com
To: haskell-cafe@haskell.org; hask...@haskell.org; hope...@haskell.org
Subject: ANN: GPipe-TextureLoad 1.0.0 and GPipe 1.0.3
Date: Mon, 26 Oct 2009 22:37:01 +0100



I've uploaded a new version of GPipe as well as a utility package for loading 
textures.
 
GPipe 1.0.3:
* Fixes a major bug in the shader generation
 
GPipe-TextureLoad 1.0.0:
* Helps loading GPipe textures from file. It is based on the stb-image package, 
and supports subsets of the JPG, PNG, TGA, BMP and PSD formats.
 



kolla in resten av Windows LiveT. Inte bara e-post - Windows LiveT är mycket 
mer än din inkorg. Mer än bara meddelanden  
 
_
Hitta kärleken nu i vår!
http://dejting.se.msn.com/channel/index.aspx?trackingid=1002952___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] ANN: GPipe-TextureLoad 1.0.0 and GPipe 1.0.3

2009-10-26 Thread Tobias Bexelius

I've uploaded a new version of GPipe as well as a utility package for loading 
textures.

 

GPipe 1.0.3:

* Fixes a major bug in the shader generation

 

GPipe-TextureLoad 1.0.0:

* Helps loading GPipe textures from file. It is based on the stb-image package, 
and supports subsets of the JPG, PNG, TGA, BMP and PSD formats.

 
  
_
Hitta kärleken nu i vår!
http://dejting.se.msn.com/channel/index.aspx?trackingid=1002952___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] ANN: Extensions to Vec uploaded (useful for GPipe programs)

2009-10-10 Thread Tobias Bexelius

Hi,

 

I've added two extensions to the Vec package: Vec-Transform and Vec-Boolean. 
These two packages are more or less essential when programming GPipe programs, 
but can also be useful for other applications as well.

 

* Vec-Transform provides some 4x4 transform matrices such as perspective 
projection and rotation.

 

* Vec-Boolean provides Data.Boolan instances for the Vec data types.

 

 

Cheers

 

/Tobias
  
_
Windows Live: Håll dina vänner uppdaterade om vad du gör online.
http://www.microsoft.com/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:sv-se:SI_SB_1:092010___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] GPipe example and screenshot

2009-10-08 Thread Tobias Bexelius

I've put a simple GPipe example (including a screenshot) on the haskellwiki 
now, showing off an animated spinning box.

 

You'll find the page here:

http://www.haskell.org/haskellwiki/GPipe

 

Later on, I will add more examples, and also some kind of GPipe-tutorial. Hang 
in there...

 

 

Cheers

Tobias Bexelius

 
  
_
Windows Live: Gör det enklare för dina vänner att se vad du håller på med på 
Facebook.
http://www.microsoft.com/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:sv-se:SI_SB_2:092009___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] RE: [Haskell] ANNOUNCE: GPipe-1.0.0: A functional graphics API for programmable GPUs

2009-10-07 Thread Tobias Bexelius

Hi Petr,
 
Your question is completely justified! Yes, I beleive GPipe is a good 
foundation for such GPGPU-computations (general purpose GPU-programming), 
giving you easy access to data parallelism.
 
A way of doing this is to start with one or more equally sized textures that is 
your input (1 component depth textures perserves most floating point precision) 
. Then you rasterize a quad that covers the entire FrameBuffer, and for each 
fragment point sample these input textures and perform some computation on the 
samples. The resulting framebuffer can then be converted to a normal list in 
main memory, or converted to another texture to be used as input in another 
pass. 
 
To gather data, e.g. sum up all values in a texture, you could make a fragment 
program that uses a half-sized quad in which you sample two parts of the 
texture which you add and return in a half-sized texture. If you repeat this 
log2 texturesize times, you end up with one single value that is the sum of all 
values.
 
All texture loading and retrieving functions in GPipe are in IO, but safe to 
wrap in unsafePerformIO as long as you guarantee that the Ptr's are safe. So I 
think its easy to modularize GPGPU computations in GPipe and for instance 
create something like:
 simpleGPUmap :: (Fragment Float - Fragment Float) - [Float] - [Float]
 
So, why dont you have a go on it? It might just turn out to be a pretty useful 
library... ;)
 
 
Cheers
/Tobias
 
 
 
 Date: Wed, 7 Oct 2009 16:47:15 +0200
 From: d...@pudlak.name
 To: tobias_bexel...@hotmail.com
 CC: haskell-cafe@haskell.org
 Subject: Re: [Haskell] ANNOUNCE: GPipe-1.0.0: A functional graphics API for 
 programmable GPUs
 
 Hi Tobias,
 
 (I'm completely new to GPU programming, so my question may be completely
 stupid or unrelated. Please be patient :-).)
 
 Some time ago I needed to perform some large-scale computations
 (searching for first-order logic models) and a friend told me that GPUs
 can be used to perform many simple computations in parallel. Could GPipe
 be used for such a task? I.e. to program some non-graphical,
 parallelized algorithm, which could be run on a GPU cluster?
 
 Thanks for your answer,
 
 Petr
 
 On Sun, Oct 04, 2009 at 08:32:56PM +0200, Tobias Bexelius wrote:
  I'm proud to announce the first release of GPipe-1.0.0: A functional 
  graphics
  API for programmable GPUs.
  
  GPipe models the entire graphics pipeline in a purely functional, immutable
  and typesafe way. It is built on top of the programmable pipeline (i.e.
  non-fixed function) of OpenGL 2.1 and uses features such as vertex buffer
  objects (VBO's), texture objects and GLSL shader code synthetisation to 
  create
  fast graphics programs. Buffers, textures and shaders are cached internally 
  to
  ensure fast framerate, and GPipe is also capable of managing multiple 
  windows
  and contexts. By creating your own instances of GPipes classes, it's 
  possible
  to use additional datatypes on the GPU.
  
  You'll need full OpenGL 2.1 support, including GLSL 1.20 to use GPipe. 
  Thanks
  to OpenGLRaw, you may still build GPipe programs on machines lacking this
  support.
  
  The package, including full documentation, can be found at:
  http://hackage.haskell.org/package/GPipe-1.0.0
  
  Of course, you may also install it with:
  cabal install gpipe
  
  
  Cheers!
  Tobias Bexelius
  
  ━━
  kolla in resten av Windows LiveT. Inte bara e-post - Windows LiveT är mycket
  mer än din inkorg. Mer än bara meddelanden







Windows Live: Håll dina vänner uppdaterade om vad du gör online.
  
_
Hitta kärleken nu i vår!
http://dejting.se.msn.com/channel/index.aspx?trackingid=1002952___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


RE: [Haskell-cafe] ANN: Real World Haskell, now shipping

2008-12-04 Thread Tobias Bexelius
An even more painless way to do it is to edit the .cabal file (or just
cabal on Windows) in the cabal user directory (somwhere under the
AppData folder on windows), to have default values for
extra-include-dirs and extra-lib-dirs. Then you don't need to enter them
explicitly every time you use cabal.

/Tobias


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Judah Jacobson
Sent: den 4 december 2008 01:07
To: Andrew Coppin
Cc: haskell-cafe@haskell.org
Subject: Re: [Haskell-cafe] ANN: Real World Haskell, now shipping

On Wed, Dec 3, 2008 at 11:53 AM, Andrew Coppin
[EMAIL PROTECTED] wrote:
 Brandon S. Allbery KF8NH wrote:

 On 2008 Dec 2, at 14:44, Andrew Coppin wrote:

 Regardless, it has been my general experience that almost everything

 obtained from Hackage fails miserably to compile under Windows. 
 (IIRC, one package even used a Bash script as part of the build 
 process!) I haven't seen similar problems on Linux. (But I don't use

 Linux very often.) About the worst problem there was Gtk2hs being 
 confused about some Autoconfig stuff or something...


 Many packages assume you have the msys / mingw stuff installed on 
 Windows (if they work at all; those of us who don't develop on 
 Windows wouldn't really know how to go about being compatible).


 According to the Cabal experts, the issue is that Windows doesn't have

 a standard place for keeping header files like the various POSIX 
 environments typically do. That means anything that binds an external 
 C library (i.e., almost all useful Haskell packages) don't easily work

 on Windows. I'm not sure what the solution to this is...

Have you tried passing the --extra-include-dirs and --extra-lib-dirs
arguments to 'cabal install'?  On OS X, that's how I deal with the
macports package manager which puts all library files under /opt/local.
I've found the process pretty painless.

-Judah
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


RE: [Haskell-cafe] Pattern matching on numbers?

2008-11-19 Thread Tobias Bexelius
Yes, fromInteger and == is used for pattern matching on numbers.
However, on GHC you can use -XNoImplicitPrelude to make it use whatever
fromInteger and == that's in scope (without any Num or Eq).

Eg. if == is a method of MyEq class and fromInteger is a method of
MyNum, and MyNum doesn't inherit MyEq, then the type of this function

f 0 = 
f x = 'e' : f (x-1)

Will be inferred as (MyEq a, MyNum a) = a - String

/Tobias

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of David Menendez
Sent: den 19 november 2008 01:00
To: Henning Thielemann
Cc: Haskell Cafe
Subject: Re: [Haskell-cafe] Pattern matching on numbers?

On Tue, Nov 18, 2008 at 6:56 PM, Henning Thielemann
[EMAIL PROTECTED] wrote:

 On Tue, 18 Nov 2008, Ryan Ingram wrote:

 How does this work?

 fac n = case n of
   0 - 1
   _ - n * fac (n-1)

 ghci :t fac
 fac :: (Num t) = t - t

 The first line of fac pattern matches on 0.  So how does this work 
 over any value of the Num typeclass?  I know that the 1 on the rhs 
 of fac are replaced with (fromInteger 1), but what about numeric 
 literals in patterns?  Does it turn into a call to (==)?

 As far as I know, yes. It is even possible to trap into an error on 
 pattern matching this way if fromInteger generates an 'undefined'.

As I understand it, the use of (==) in numeric pattern matching is why
Num requires Eq.

--
Dave Menendez [EMAIL PROTECTED]
http://www.eyrie.org/~zednenem/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


RE: [Haskell-cafe] GHC 6.10.1 and cabal[-install]

2008-11-18 Thread Tobias Bexelius
Hi,

I used the cabal-install on hackage:
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/cabal-install

In order to install it you will need these two packages first:
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/HTTP-3001.1.4
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/zlib-0.5.0.0


For each package (starting with the last two of course), run:

 runghc Setup configure
 runghc Setup build
 runghc Setup install

Once its all done, you can instead use

cabal install x

to install package x, and don't need to care about dependencies anymore. And 
theres nothing else you need to do in order to integrate it with ghc either...
 
/Tobias

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Wolfgang Jeltsch
Sent: den 18 november 2008 11:01
To: haskell-cafe@haskell.org
Subject: [Haskell-cafe] GHC 6.10.1 and cabal[-install]

Hello,

I installed GHC 6.10.1 today and expected it to contain the cabal command line 
utility.  Unfortunately, this was not the case.  Where can I download it?  
How do I install and configure it so that it is integrated best with 
GHC 6.10.1?  For example, should cabal use some directory in the GHC tree to 
place compiled packages in?

http://hackage.haskell.org/ still links to cabal-install for a convenient way 
for installing packages.  I thought that cabal-install is outdated.  
Isn't it?  Generally, Cabal info and documentation ist too hard to find on the 
web, in my opinion.

Best wishes,
Wolfgang
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Getting rid of functional dependencies with type proxies

2008-11-13 Thread Tobias Bexelius
Hi,
 
some time ago I asked about a problem I had with functional dependencies
conflicting when using overlapping instances in a code like this:
 
 
{-# OPTIONS_GHC -fglasgow-exts -fallow-undecidable-instances
-fallow-incoherent-instances #-}
data V2 a = V2 a a
class Vec v a where
dot :: v a - v a - a
instance Num a = Vec V2 a where
V2 a1 a2 `dot` V2 b1 b2 = a1*b1+a2*b2
class Mult a b c | a b - c where
(*.) :: a - b - c
instance (Num x) = Mult x x x where (*.) = (*)
instance (Vec a x) = Mult (a x) (a x) x where (*.) = dot

{-
Functional dependencies conflict between instance declarations:
  instance [overlap ok] (Num x) = Mult x x x
  instance [overlap ok] (Vec a x) = Mult (a x) (a x) x
-}

The problem here is that the dependency check is occuring too soon.
Removing the dependency would solve the problem, but then you would need
to put type annotations everywhere you use the multiplication operator,
and that's not acceptable.
However, I did found a solution I would like to share with you: Creating
a type proxy! I find it strange that such a simple solution to such a
(for me at least) common problem hasn't been documented more.
This is the working code:

{-# OPTIONS_GHC -fglasgow-exts -fallow-undecidable-instances
-fallow-incoherent-instances #-}
data V2 a = V2 a a
class Vec v a where
dot :: v a - v a - a
instance Num a = Vec V2 a where
V2 a1 a2 `dot` V2 b1 b2 = a1*b1+a2*b2
class Mult a b c | a b - c where
(*.) :: a - b - c
class MultProxy a b c where
(*..) :: a - b - c
instance MultProxy a b c = Mult a b c where
(*.) = (*..)
instance (Num x) = MultProxy x x x where (*..) = (*)
instance (Vec a x) = MultProxy (a x) (a x) x where (*..) = dot


Thanks to Emil Axelsson that pointed me to
http://haskell.org/haskellwiki/GHC/AdvancedOverlap, where similar
problems where discussed. Again, I haven't found links to this page in
any of the Haskell tutorials I've read so far.

/Tobias
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


RE: [Haskell-cafe] Memory efficiency questions for real-time graphics

2008-11-05 Thread Tobias Bexelius
I believe Svein is thinking of render-to-texture which indeed could be
used to emulate Stream-Out functionality (but with reduced performance
of course). This is also hardware specific and was still not supported
on the first GPU's.

 


From: Sebastian Sylvan [mailto:[EMAIL PROTECTED] 
Sent: den 4 november 2008 20:06
To: [EMAIL PROTECTED]
Cc: Tobias Bexelius; haskell-cafe@haskell.org
Subject: Re: [Haskell-cafe] Memory efficiency questions for real-time
graphics




On Mon, Nov 3, 2008 at 3:45 PM, Svein Ove Aas [EMAIL PROTECTED] wrote:


On Mon, Nov 3, 2008 at 11:31 AM, Tobias Bexelius
[EMAIL PROTECTED] wrote:
 Before Direct3D 10, its too costly to read back the updated
vertex data
 in every frame, which force you to make this kind of
operations on the
 CPU.
 With D3D 10 however, you should use the new Stream-Output
stage which is
 used to return updated vertex data directly to a vertex buffer
on the
 GPU. So if you can afford a new graphics card and likes Vista,
that's
 the way to go :)


Or you could use OpenGL, which has supported that since the
first GPUs
that did were released.


I think that came with OpenGL 3.0. Unless you're counting
vendor-specific extensions... 

-- 
Sebastian Sylvan
+44(0)7857-300802
UIN: 44640862

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Functional dependencies and incoherent instances

2008-10-08 Thread Tobias Bexelius
Hi,

Im trying to overload a multiplication operator for scalars and vectors,
but keep running into the error message Functional dependencies
conflict. What I think is going on is that the dependency check doesn't
work with incoherent (or overlapping) instances. In the example below,
the two instances of Mult are overlapping. What I want is the vector
version to be used for vectors and the scalar version used for numbers,
even if a vector-type is an instance of the Num-class (I believe
-fallow-incoherent-instances would make that kind of choise for me,
right?).

Im using the Visual Studio plugin Visual Haskell, and thus GHC version
6.6. Otherwise I think associated types might have worked better for
this...

Regards
Tobias Bexelius



{-# OPTIONS_GHC -fglasgow-exts -fallow-undecidable-instances
-fallow-incoherent-instances #-}

data V2 a = V2 a a

class Vec v a where
dot :: v a - v a - a
instance Num a = Vec V2 a where
V2 a1 a2 `dot` V2 b1 b2 = a1*b1+a2*b2

class Mult a b c | a b - c where
(*.) :: a - b - c
instance (Num x) = Mult x x x where (*.) = (*)
instance (Vec a x) = Mult (a x) (a x) x where (*.) = dot
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


RE: [Haskell-cafe] Functional dependencies and incoherent instances

2008-10-08 Thread Tobias Bexelius
Yeah, I realized that.

But heres where I would like the undecidable incoherent instances to kick in, 
i.e. as long as I haven't got any NumVec instances GHC should be able to choose 
only one of the Mult instances. Or do I have too much faith in the 
-fallow-incoherent-instances flag now? :/

I would like to be able to write something like
 instance (Vec a x, -Num (a x)) = Mult (a x) (a x) x where (*.) = dot
where -Num (a x) means that (a x) must not be an instance of Num. Can I express 
this in some way?

Regards
Tobias

-Original Message-
From: Joel Björnson [mailto:[EMAIL PROTECTED] 
Sent: den 8 oktober 2008 15:50
To: Tobias Bexelius
Cc: haskell-cafe@haskell.org
Subject: Re: [Haskell-cafe] Functional dependencies and incoherent instances

Hi,

On Wed, Oct 8, 2008 at 2:31 PM, Tobias Bexelius [EMAIL PROTECTED] wrote:
 Hi,

 Im trying to overload a multiplication operator for scalars and 
 vectors, but keep running into the error message Functional 
 dependencies conflict. What I think is going on is that the 
 dependency check doesn't work with incoherent (or overlapping) 
 instances. In the example below, the two instances of Mult are 
 overlapping. What I want is the vector version to be used for vectors 
 and the scalar version used for numbers, even if a vector-type is an 
 instance of the Num-class (I believe -fallow-incoherent-instances 
 would make that kind of choise for me, right?).

 Im using the Visual Studio plugin Visual Haskell, and thus GHC version 
 6.6. Otherwise I think associated types might have worked better for 
 this...


 {-# OPTIONS_GHC -fglasgow-exts -fallow-undecidable-instances 
 -fallow-incoherent-instances #-}

 data V2 a = V2 a a

 class Vec v a where
dot :: v a - v a - a
 instance Num a = Vec V2 a where
V2 a1 a2 `dot` V2 b1 b2 = a1*b1+a2*b2

 class Mult a b c | a b - c where
(*.) :: a - b - c
 instance (Num x) = Mult x x x where (*.) = (*) instance (Vec a x) = 
 Mult (a x) (a x) x where (*.) = dot

According to the definition of Mult the parameter 'c' from above should be 
uniquely determined by a pair of types 'a' and 'b'. Now, lets say we have a 
type NumVec that instantiates both the Vec class and the Num as in

instance Num (NumVec a) where
instance Vec NumVec a where

Then according to the instance declaration

instance (Num x) = Mult x x x where ...

(NumVec a)  (NumVec a) (NumVec a) instantiates the class. On the other hand 
looking at the instance declaration:

instance (Vec a x) = Mult (a x) (a x) x where ...

(NumVec a) (NumVec a)  a , is also an instance why the fun dep (a b -
c) is violated.

Regards,
Joel
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe