/PixelMagic

HLSL implementation for the CLR

Primary LanguageC#OtherNOASSERTION

PixelMagic
==========

PixelMagic is a framework that implements HLSL shaders. It features both an interpreter
and a compiler that generates Mono.Simd code that can exploit the full potential of your
CPU. Only PS 2.0 is supported.

Effects can be applied to in-memory buffers or cairo image surfaces.

Testing
===========

The test suite is generated by applying shaders to a png image and saving the result.

Some of the effects come from (http://wpffx.codeplex.com/).

TODO
====

Figure out what's wrong with lerp-2 and gloom.

Compiler:
	Write results using a Surface object, this is slow.
	Specialize for simple samplers so their can be inlined
	Texture coords should be folded into a pair of floats if only used with texload
	Maybe eliminate the i,j loop variables and test for tex.x|y < 0
	Remove the fdiv in the inner loop, cache hq / 2 in a variable outside
	Use loop tilling if any sampler is doing bilinear filtering or if we detect that fetches are transformed.
	Enforce declared variable write mask on stores.
	Better code can be generated for single component write masks.
	Detect SSE4 and use BLENDPS for masks.
	Figure out texture coord regs and generalize current code.
	Using the Series for JIT'ing SinCos is probably better than calling into x87 junk

Math:
	Figure out to to implement FRC with decent speed.
	Use some of gallium's tricks to improve speed of some ops.

Misc:
	The texture read/write code is not endian safe.

TestSuite:
	We produce some artifacts with pixelate.

Mono:
	JIT "newobj Vector4f" property.
	When passing float constants to setters/constructors avoid the slow FPU->memory->XMM path.
	Teach the JIT to emit a constant load in case of constructors where all arguments are constants.

Known Issues
============

Mono 2.6 release on OSX miscompiles Mono.Simd code. Trunk works fine, check tip of 2.6.



Links
=====

HLSL reference: http://msdn.microsoft.com/en-us/library/bb219847(VS.85).aspx
Shader codes: http://msdn.microsoft.com/en-us/library/ff552891(VS.85).aspx