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)
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)
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!
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
apack compress even more
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.
2. IDirect3DDevice9::ColorFill might do the job. No shaders on it though, its a flat colour.
3,4: without knowing what youve already got, its not possible to know what you dont need.
Can't you fetch pixel position directly in the pixel shader? (like gl_FragCoord in glsl).
Yeah, you don't need any texture coordinates.
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
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
parcelshit: in dx youve got the vpos register, but it gives it to you in pixel coordinates.
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.