Skip to content

Commit

Permalink
win32: cgp fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
OV2 committed Apr 21, 2013
1 parent 555f511 commit 987f13b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion win32/CD3DCG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ void CD3DCG::ensureTextureSize(LPDIRECT3DTEXTURE9 &tex, D3DXVECTOR2 &texSize,
wantedSize.x, wantedSize.y,
1, // 1 level, no mipmaps
renderTarget?D3DUSAGE_RENDERTARGET:0,
renderTarget?(useFloat?D3DFMT_A32B32G32R32F:D3DFMT_X8R8G8B8):D3DFMT_R5G6B5,
renderTarget?(useFloat?D3DFMT_A32B32G32R32F:D3DFMT_A8R8G8B8):D3DFMT_R5G6B5,
renderTarget?D3DPOOL_DEFAULT:D3DPOOL_MANAGED, // render targets cannot be managed
&tex,
NULL );
Expand Down Expand Up @@ -569,6 +569,8 @@ void CD3DCG::Render(LPDIRECT3DTEXTURE9 &origTex, D3DXVECTOR2 textureSize,
*/
setViewport(0,0,shaderPasses[i].outputSize.x,shaderPasses[i].outputSize.y);

pDevice->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);

pDevice->BeginScene();
pDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP,0,2);
pDevice->EndScene();
Expand Down Expand Up @@ -663,13 +665,21 @@ void CD3DCG::setShaderVars(int pass)
#define setTextureParameter(pass,varname,val,linear)\
{\
CGparameter cgpf = cgGetNamedParameter(shaderPasses[pass].cgFragmentProgram, varname);\
CGparameter cgpv = cgGetNamedParameter(shaderPasses[pass].cgVertexProgram, varname);\
if(cgpf) {\
cgD3D9SetTexture(cgpf,val);\
cgD3D9SetSamplerState(cgpf, D3DSAMP_ADDRESSU, D3DTADDRESS_BORDER);\
cgD3D9SetSamplerState(cgpf, D3DSAMP_ADDRESSV, D3DTADDRESS_BORDER);\
cgD3D9SetSamplerState(cgpf, D3DSAMP_MINFILTER, linear?D3DTEXF_LINEAR:D3DTEXF_POINT);\
cgD3D9SetSamplerState(cgpf, D3DSAMP_MAGFILTER, linear?D3DTEXF_LINEAR:D3DTEXF_POINT);\
}\
if(cgpv) {\
cgD3D9SetTexture(cgpv,val);\
cgD3D9SetSamplerState(cgpv, D3DSAMP_ADDRESSU, D3DTADDRESS_BORDER);\
cgD3D9SetSamplerState(cgpv, D3DSAMP_ADDRESSV, D3DTADDRESS_BORDER);\
cgD3D9SetSamplerState(cgpv, D3DSAMP_MINFILTER, linear?D3DTEXF_LINEAR:D3DTEXF_POINT);\
cgD3D9SetSamplerState(cgpv, D3DSAMP_MAGFILTER, linear?D3DTEXF_LINEAR:D3DTEXF_POINT);\
}\
}\

#define setTexCoordsParameter(pass,varname,val)\
Expand Down

0 comments on commit 987f13b

Please sign in to comment.