pouët.net

Go to bottom

making a small intro with directx (need some tips)

category: general [glöplog]
 
I'm trying to grab a few bytes from a 1kb windows intro. Currently i haveto make it 20 bytes smaller (1044 bytes)

1. to get pixel position inside the shader i declare like this :
float4 t(float2 p:VPOS):COLOR

unfortunatly its not centered and doesnt take care about screen aspect (4/3 16/9...)
so i add these lines

"x=(p.x-320)*.006*z*1.2;"
"y=(p.y-240)*.006*z;"

(z is for internal use, 1.2 correct aspect)
possibilty to avoid this?

2. is there a way to draw directly a flat square on the screen?
(like glrecti)...
right now i'm doing this :
Quad real4 -1.0, -1.0, 0.0, -1.0, -1.0
real4 -1.0, 1.0, 0.0, -1.0, 1.0
real4 1.0, 1.0, 0.0, 1.0, 1.0
real4 1.0, -1.0, 0.0, 1.0, -1.0
and then call DrawPrimitiveUP

3. my minimal framework (everything without the shader) is 600bytes (packed), did someone manage to get lower??

4. any more tips about directx initialisation ?? (things i can omit and so)
added on the 2008-11-11 15:27:39 by Tigrou Tigrou
i guess you use crinkler!

have you tried to use the /TRUNCATEFLOATS flag?

just try /TRUNCATEFLOATS:32 and see if its smaller afterwards and if the code still works as wanted...if so,try 16 and so on...helpfile tells you more!
nope, for very small stuff (1k) crinkler dont give promisiing results
apack compress even more
added on the 2008-11-11 15:45:10 by Tigrou Tigrou
1. if youve got a vertex shader cant you pass the -1 to 1 position up via a texture coordinate?
2. IDirect3DDevice9::ColorFill might do the job. No shaders on it though, its a flat colour.
added on the 2008-11-11 15:49:05 by smash smash
3,4: without knowing what youve already got, its not possible to know what you dont need.
added on the 2008-11-11 15:49:37 by smash smash
Can't you fetch pixel position directly in the pixel shader? (like gl_FragCoord in glsl).
Yeah, you don't need any texture coordinates.
added on the 2008-11-11 16:00:52 by hitchhikr hitchhikr
seems right with apack...as i´m still @ 697bytes,haha...gotta try it!
@parcelshit
thats what i'm trying to do in dx,

the problem is i dont know very well dx + shaders, i code mostly in gl and switch to dx for this project to make the stuff smaller
added on the 2008-11-11 16:02:45 by Tigrou Tigrou
parcelshit: in dx youve got the vpos register, but it gives it to you in pixel coordinates.
added on the 2008-11-11 16:08:36 by smash smash
Same as gl_FragCoord then so you still have to do some transformation on it, but the shader code to do that is probably less costly than the equivilant set-up machine code.

login

Go to top