Sign in to follow this  
ChopperDave

Overriding shader use?

Recommended Posts

ChopperDave    228
I just seem to be full of problems. This quite a learning experience for me (albeit frustrating). For some reason, I have shaders that are being set in my effect file but not being executed. My effect file looks like so:

float4 viewportScale;
float4 viewportBias; 

struct INPUT_PPVS {
  float4 pos : POSITION;
  float2 texCoord : TEXCOORD0;
};

struct OUTPUT_PPVS {
  float4 pos : POSITION;
  float2 texCoord : TEXCOORD0;
};

OUTPUT_PPVS ppvs(INPUT_PPVS v) {
  OUTPUT_PPVS o = (OUTPUT_PPVS) 0;

  o.pos = v.pos * viewportScale + viewportBias;

  o.texCoord = v.texCoord;

  return o;
}


float2 filterSamples[12];

struct INPUT_PPPS {
  float2 texCoord : TEXCOORD0;
};

float4 ppps(INPUT_PPPS v) : COLOR {

  float4 totalColor = tex2D(ColorMapSampler,v.texCoord); //samplers made earlier
  float totalCont = 1.0;
  float2 depthBlur = tex2D(DepthBlurMapSampler,v.texCoord); 
  float cocSize = depthBlur.y * maxCOC;

  for (int i = 0; i < 12; i++) {
    float2 sampleCoord = v.texCoord + filterSamples[i] * cocSize;
    float4 sampleColor = tex2D(ColorMapSampler,sampleCoord);       
    float2 sampleDepthBlur = tex2D(DepthBlurMapSampler,sampleCoord); 
    float sampleCont = (sampleDepthBlur.x > depthBlur.x) ? 1.0 : sampleDepthBlur.y;
    totalColor += sampleColor * sampleCont;
    totalCont += sampleCont;
  }

  return (totalColor/totalCont);
}


vertexshader postprocessvs = compile vs_2_0 ppvs();
pixelshader postprocessps = compile ps_2_0 ppps();

technique SimCOC {
  pass P0 {
	 ...
  }
  pass P1 {
       Sampler[0] = (ColorMapSampler);
       Sampler[1] = (DepthBlurMapSampler);
       ZEnable = False;
       fvf = XYZW | Tex1;
       vertexshader = (postprocessvs);
       pixelshader = (postprocessps);
       
  }
}


In my rendering code I have tried two things for drawing: one using vertices stored in a vertex buffer, and the other using DrawPrimitiveUP using an array of vertices. Here is what the rendering code looks like:
//effect->Begin done elsewhere
effect->SetTexture("colorMap",colorMap);
	effect->SetTexture("depthBlurMap",depthBlurMap);
	
	if(SUCCEEDED(device->BeginScene())) {
		effect->BeginPass(1);
		device->SetStreamSource(0,vb,0,sizeof(Vertex));
		device->DrawPrimitive(D3DPT_TRIANGLEFAN, 0, 2);
		effect->EndPass();
		device->EndScene();
	}
	effect->End();


I've also tried this:
effect->SetTexture("colorMap",colorMap);
	effect->SetTexture("depthBlurMap",depthBlurMap);
	
	Vertex vertices[] = {{0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f},
	{1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f},
	{1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f},//x,y,z,w,u,v
	{0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f}};

	if(SUCCEEDED(device->BeginScene())) {
		effect->BeginPass(1);
		device->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, &vertices, sizeof(Vertex));
		effect->EndPass();
		device->EndScene();
	}
	effect->End();


The first way neither of the shaders executes. In the second way, the vertex shader will sometimes execute, but only if the pixel shader is deactivated or does next to nothing. The pixel shader runs normally only if the vertex shader is skipped over. What in the world is going on? [Edited by - ChopperDave on April 17, 2006 12:11:45 AM]

Share this post


Link to post
Share on other sites
sirob    1181
You should place all Effect-> calls between the BeginScene and EndScene. Also, the order for the calls to the effect interface is Begin, BeginPass, Draw*Prim, EndPass, End.

So, your code should look something like this:


effect->SetTexture("colorMap",colorMap);
effect->SetTexture("depthBlurMap",depthBlurMap);

if(SUCCEEDED(device->BeginScene())) {
effect->Begin();
effect->BeginPass(1);
device->SetStreamSource(0,vb,0,sizeof(Vertex));
device->DrawPrimitive(D3DPT_TRIANGLEFAN, 0, 2);
effect->EndPass();
effect->End();
device->EndScene();
}



Hope this helps.

Share this post


Link to post
Share on other sites
ChopperDave    228
I don't do effect->Begin and End within the begin and end scenes because I use the same technique on both render passes, just a different pass from that technique. I went ahead and tried it your way anyways, and it had no effect.

Any other ideas?

Share this post


Link to post
Share on other sites
sirob    1181
You should only be calling BeginScene and EndScene once per frame. Any DX call should ultimatly be between the two calls. An EndScene should be followed by a Present call.

If you want to perform two passes, just do them both between your begin/end scene calls.

Hope this helps.

Share this post


Link to post
Share on other sites
ChopperDave    228
Scale is (800.0,600.0,1.0,1.0) and bias is (-0.5,-0.5,0,0). I'm not sure how that matters seeing as how the shader doesn't even execute (I put in breakpoints to debug). Let me know what you come up with.

Share this post


Link to post
Share on other sites
ChopperDave    228
OK. I still haven't gotten my post process shaders to execute and I don't know why. Here is what my code looks like:

void render() {
float zfoc;
float* LVals = DOF->getLensValues();
ID3DXEffect* fx = DOF->getEffect();

if(SUCCEEDED(DOF->sceneRender())) {
for (int i = 0; i < 4; i++) {
fx->SetMatrix("worldViewProj", &worldViewProj[i]);
fx->SetMatrix("worldView",&worldView[i]);
fx->SetVector("ambMat",&ambMat[i]);
fx->SetVector("difMat",&difMat[i]);

zfoc = (float)(fabs(1/((1/LVals[FLENS]) - (1/dist[i]))) + dist[i]);
fx->SetFloat("zFocus",zfoc);
fx->CommitChanges();

meshes[i]->DrawSubset(0);
}
DOF->postProcess();
}
device->Present(NULL,NULL,NULL,NULL);
}

//In the DOF object
HRESULT DepthOfField::sceneRender() {
UINT passes;
device->SetRenderTarget(0,colorMapSurf);
device->SetRenderTarget(1,depthBlurMapSurf);

device->Clear(NULL,0,D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER,D3DCOLOR_XRGB(0,0,0),1,0);

if(SUCCEEDED(device->BeginScene())) {
effect->Begin(&passes,0);
effect->BeginPass(0);
return S_OK;
}
else
return E_FAIL;
}

void DepthOfField::postProcess() {
effect->EndPass();

device->SetRenderTarget(0,originalSurf);
device->SetRenderTarget(1,NULL);

device->Clear(NULL,0,D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER,D3DCOLOR_XRGB(0,0,0),1,0);

effect->SetTexture("colorMap",colorMap);
effect->SetTexture("depthBlurMap",depthBlurMap);

effect->BeginPass(1);

device->SetFVF(VertexFVF);
device->SetStreamSource(0,vb,0,sizeof(Vertex));
device->DrawPrimitive(D3DPT_TRIANGLEFAN, 0, 2);
effect->EndPass();
effect->End();
device->EndScene();
}


//And in my effect file

vertexshader scenerendervs = compile vs_2_0 srvs();
pixelshader scenerenderps = compile ps_2_0 srps();
vertexshader postprocessvs = compile vs_2_0 ppvs();
pixelshader postprocessps = compile ps_2_0 ppps();

technique SimCOC {
pass P0 {
fvf = XYZ | Normal | Tex1;
ZEnable = True;
vertexshader = (scenerendervs);
pixelshader = (scenerenderps);
}

pass P1 {
Sampler[0] = (ColorMapSampler);
Sampler[1] = (DepthBlurMapSampler);
ZEnable = False;
fvf = XYZRHW | Tex1;
vertexshader = (postprocessvs);
pixelshader = (postprocessps);

}
}


The scene render pass works perfectly, but the shaders in the post process pass don't even execute (I used breakpoints to check). What is going on?

Share this post


Link to post
Share on other sites
Demirug    884
Your FVF contains XYZRHW. If you use pretransformed vertices the vertex shader will never called. Any vertex data you provide is passed direct to the next pipeline stage.

Share this post


Link to post
Share on other sites
ChopperDave    228
I see what you're saying. Unfortunately, that had no effect (I switched it to XYZ). Any other ideas?

Maybe showing my vertex struct will help:

struct Vertex {
float x;
float y;
float z;
float w;
float u;
float v;
Vertex(){};
Vertex(float x,float y,float z,float w,float u,float v){
x = x;
x = y;
z = z;
w = w;
u = u;
v = v;
};
};

Share this post


Link to post
Share on other sites
ET3D    810
Your vertex structure still contains w. This would make your shader get the wrong data (though it shouldn't prevent it from executing).

Share this post


Link to post
Share on other sites
ChopperDave    228
True. And even if I used XYRHW, the pixel shader still should have executed. Just out of curiosity, if I drop the 'w' from my vertex struct, should I still have the position in my shader be a float4? Or should it be a float3?

I've got the feeling that the pass isn't even being executed, but the call returns S_OK.

Any other ideas?

Share this post


Link to post
Share on other sites
jollyjeffers    1570
Quote:
Original post by ChopperDave
Just out of curiosity, if I drop the 'w' from my vertex struct, should I still have the position in my shader be a float4? Or should it be a float3?
I forget what the spec dictates, but it'll take a default value - either 0.0 or 1.0. Bottom line is probably best to match them up unless you really can't for some reason [smile]

Quote:
Original post by ChopperDave
I've got the feeling that the pass isn't even being executed, but the call returns S_OK.
What do the debug runtimes say? Failed shader linkage can often silently fail - but you'll get 1000's of debug statements indicating the problem.

hth
Jack

Share this post


Link to post
Share on other sites
ET3D    810
Try using "ValidateTechnique" to check if the technique is okay.

BTW, I've just looked at your pixel shader, and I'd be surprised if it compiles under ps_2_0. That's limited to 64 arithmetic instructions, and you seem to have more than that.

Share this post


Link to post
Share on other sites
ChopperDave    228
Yeah I do validate it, and it comes out OK. It does compile under 2.0 if it's optimized; if not, then you're right it has too many instructions.

I'm gonna see what the debug spews out, if anything.

Share this post


Link to post
Share on other sites
ChopperDave    228
Here is what my debug output looks like:


'DOF2.exe': Loaded 'C:\Documents and Settings\guy\Desktop\DOF\Debug\DOF2.exe', Symbols loaded.
'DOF2.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll', No symbols loaded.
'DOF2.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll', No symbols loaded.
'DOF2.exe': Loaded 'C:\WINDOWS\system32\d3d9.dll', No symbols loaded.
'DOF2.exe': Loaded 'C:\WINDOWS\system32\d3d8thk.dll', No symbols loaded.
'DOF2.exe': Loaded 'C:\WINDOWS\system32\gdi32.dll', No symbols loaded.
'DOF2.exe': Loaded 'C:\WINDOWS\system32\user32.dll', No symbols loaded.
'DOF2.exe': Loaded 'C:\WINDOWS\system32\msvcrt.dll', No symbols loaded.
'DOF2.exe': Loaded 'C:\WINDOWS\system32\advapi32.dll', No symbols loaded.
'DOF2.exe': Loaded 'C:\WINDOWS\system32\rpcrt4.dll', No symbols loaded.
'DOF2.exe': Loaded 'C:\WINDOWS\system32\version.dll', No symbols loaded.
'DOF2.exe': Loaded 'C:\WINDOWS\system32\winmm.dll', No symbols loaded.
'DOF2.exe': Loaded 'C:\WINDOWS\katrack.dll', No symbols loaded.
'DOF2.exe': Loaded 'C:\WINDOWS\system32\entapi.dll', No symbols loaded.
'DOF2.exe': Loaded 'C:\WINDOWS\system32\psapi.dll', No symbols loaded.
'DOF2.exe': Loaded 'C:\WINDOWS\system32\netapi32.dll', No symbols loaded.
'DOF2.exe': Unloaded 'C:\WINDOWS\system32\entapi.dll'
'DOF2.exe': Unloaded 'C:\WINDOWS\system32\netapi32.dll'
'DOF2.exe': Unloaded 'C:\WINDOWS\system32\psapi.dll'
'DOF2.exe': Loaded 'C:\WINDOWS\system32\wtsapi32.dll', No symbols loaded.
'DOF2.exe': Loaded 'C:\WINDOWS\system32\winsta.dll', No symbols loaded.
'DOF2.exe': Loaded 'C:\WINDOWS\system32\netapi32.dll', No symbols loaded.
'DOF2.exe': Unloaded 'C:\WINDOWS\system32\wtsapi32.dll'
'DOF2.exe': Unloaded 'C:\WINDOWS\system32\winsta.dll'
'DOF2.exe': Unloaded 'C:\WINDOWS\system32\netapi32.dll'
The thread 'Win32 Thread' (0x1be8) has exited with code 0 (0x0).
'DOF2.exe': Loaded 'C:\WINDOWS\system32\msctf.dll', No symbols loaded.
'DOF2.exe': Loaded 'C:\WINDOWS\system32\d3dref9.dll', No symbols loaded.
The program '[7216] DOF2.exe: Native' has exited with code 0 (0x0).



I don't see anything that stands out with regards to the shaders. Is there anything that you noticed?

Share this post


Link to post
Share on other sites
matches81    474
umm.... did you activate Direct3D debug runtime? You can do that in your control panel in the DirectX options in the Direct3D tab.
I assume you don´t have them enabled just because you should at least get some status messages from it even when everything is going fine.
Also pull the debug output level to the max.
With debug runtime you should get more information, and hopefully some useful that is.

Share this post


Link to post
Share on other sites
ChopperDave    228
Yeah, I'll have to get back to you on that. Apparently the computer I was using required an administrator to be able to change the control panel settings, so the debug wasn't enabled.

If you guys want I can post my code in it's entirety. But hopefully that won't be necessary.

Share this post


Link to post
Share on other sites
ChopperDave    228
OK. Igot some debugging info:

Direct3D9: :DoneExclusiveMode
'Direct3D REF Device 1': Attached to debug monitor.
'Direct3D REF-owned HAL (HWVP) Device 1': Attached to debug monitor.
D3D9 Helper: Error: Default value for D3DSAMP_DMAPOFFSET[0] is incorrect. Expected 0x100, Returned 0x0
D3D9 Helper: Error: Default value for D3DSAMP_DMAPOFFSET[1] is incorrect. Expected 0x100, Returned 0x0
D3D9 Helper: Error: Default value for D3DSAMP_DMAPOFFSET[2] is incorrect. Expected 0x100, Returned 0x0
D3D9 Helper: Error: Default value for D3DSAMP_DMAPOFFSET[3] is incorrect. Expected 0x100, Returned 0x0
D3D9 Helper: Error: Default value for D3DSAMP_DMAPOFFSET[4] is incorrect. Expected 0x100, Returned 0x0
D3D9 Helper: Error: Default value for D3DSAMP_DMAPOFFSET[5] is incorrect. Expected 0x100, Returned 0x0
D3D9 Helper: Error: Default value for D3DSAMP_DMAPOFFSET[6] is incorrect. Expected 0x100, Returned 0x0
D3D9 Helper: Error: Default value for D3DSAMP_DMAPOFFSET[7] is incorrect. Expected 0x100, Returned 0x0
D3D9 Helper: Error: Default value for D3DSAMP_DMAPOFFSET[8] is incorrect. Expected 0x100, Returned 0x0
D3D9 Helper: Error: Default value for D3DSAMP_DMAPOFFSET[9] is incorrect. Expected 0x100, Returned 0x0
D3D9 Helper: Error: Default value for D3DSAMP_DMAPOFFSET[10] is incorrect. Expected 0x100, Returned 0x0
D3D9 Helper: Error: Default value for D3DSAMP_DMAPOFFSET[11] is incorrect. Expected 0x100, Returned 0x0
D3D9 Helper: Error: Default value for D3DSAMP_DMAPOFFSET[12] is incorrect. Expected 0x100, Returned 0x0
D3D9 Helper: Error: Default value for D3DSAMP_DMAPOFFSET[13] is incorrect. Expected 0x100, Returned 0x0
D3D9 Helper: Error: Default value for D3DSAMP_DMAPOFFSET[14] is incorrect. Expected 0x100, Returned 0x0
D3D9 Helper: Error: Default value for D3DSAMP_DMAPOFFSET[15] is incorrect. Expected 0x100, Returned 0x0
Direct3D9: (WARN) :Vertexbuffer created with POOL_DEFAULT but WRITEONLY not set. Performance penalty could be severe.
Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 13

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 14

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 25

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 15

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 16

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 17

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 18

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 19

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 20

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 21

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 29

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 30

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 1, State: 13

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 1, State: 14

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 1, State: 25

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 1, State: 15

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 1, State: 16

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 1, State: 17

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 1, State: 18

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 1, State: 19

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 1, State: 20

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 1, State: 21

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 1, State: 29

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 1, State: 30

Direct3D9: (WARN) :Ignoring redundant SetRenderState 7

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 13

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 14

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 25

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 15

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 19

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 20

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 21

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 29

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 30

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 1, State: 13

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 1, State: 14

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 1, State: 25

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 1, State: 15

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 1, State: 19

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 1, State: 20

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 1, State: 21

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 1, State: 29

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 1, State: 30

Direct3D9: (WARN) :Ignoring redundant SetRenderState - 7

Direct3D9: (WARN) :Vertex shader function usage (D3DDECLUSAGE_TEXCOORD, 0) does not have corresponding usage in the current vertex declaration

Direct3D9: (INFO) :The vertex declaration is (Stream, Offset, Type, Method, Usage, UsageIndex):

Direct3D9: (INFO) :0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0

Direct3D9: (INFO) :0, 12, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0

Direct3D9: (WARN) :Vertex shader function usage (D3DDECLUSAGE_TEXCOORD, 0) does not have corresponding usage in the current vertex declaration

Direct3D9: (INFO) :The vertex declaration is (Stream, Offset, Type, Method, Usage, UsageIndex):

Direct3D9: (INFO) :0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0

Direct3D9: (INFO) :0, 12, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0

Direct3D9: (WARN) :Vertex shader function usage (D3DDECLUSAGE_TEXCOORD, 0) does not have corresponding usage in the current vertex declaration

Direct3D9: (INFO) :The vertex declaration is (Stream, Offset, Type, Method, Usage, UsageIndex):

Direct3D9: (INFO) :0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0

Direct3D9: (INFO) :0, 12, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0

Direct3D9: (WARN) :Vertex shader function usage (D3DDECLUSAGE_TEXCOORD, 0) does not have corresponding usage in the current vertex declaration

Direct3D9: (INFO) :The vertex declaration is (Stream, Offset, Type, Method, Usage, UsageIndex):

Direct3D9: (INFO) :0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0

Direct3D9: (INFO) :0, 12, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0

'Direct3D REF Device 1': Loaded vertex shader 'ppvs'
'Direct3D REF Device 1': Loaded vertex shader 'srvs'
'Direct3D REF Device 1': Loaded pixel shader 'ppps'
'Direct3D REF Device 1': Loaded pixel shader 'srps'
Direct3D9: (WARN) :Ignoring redundant SetRenderState 7

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 13

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 14

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 25

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 15

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 19

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 20

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 21

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 29

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 30


The program '[1224] DOF2.exe: Native' has exited with code 0 (0x0).
The program '[1224] DOF2.exe: Direct3D REF Device 1' has exited with code 0 (0x0).
The program '[1224] DOF2.exe: Direct3D REF-owned HAL (HWVP) Device 1' has exited with code 0 (0x0).



So apparently there's a problem with my FVF for the vertex and the samplers I'm using for the pixel shader. Based on that debug do you see anything wrong with my setup?

Share this post


Link to post
Share on other sites
ET3D    810
I believe it's just the FVF. Seems strange, though. If I read the messages correctly, D3D claims you're supplying position and normal instead of position and texture coords.

Share this post


Link to post
Share on other sites
ChopperDave    228
Yeah, I have no clue why it's doing that. I even tried declaring the fvf within the set call (i.e. device->SetFVF(D3DFVF_XYZ | D3DFVF_TEX1)) and it still gives the same error. Does anyone else have an idea?

Share this post


Link to post
Share on other sites
ChopperDave    228
I think I may have narrowed down one of the problems a little bit. One of the things I did was alter my post process pixel shader between two simple types:

//in render file
effect->SetTexture("colorMap",colorMap); //these textures are valid....
effect->SetTexture("depthBlurMap",depthBlurMap);//i save them to file to check

//in fx file
texture colorMap;

sampler ColorMapSampler = sampler_state
{
Texture = <colorMap>;
MinFilter = Linear;
MagFilter = Linear;
MipFilter = Linear;
};


struct INPUT_PPPS {
float2 texCoord : TEXCOORD0;
};

//Pixel shader type 1
float4 ppps(INPUT_PPPS v) : COLOR {

float4 color = tex2D(ColorMapSampler,v.texCoord);
return color;
}

//Pixel shader type 2

float4 ppps(INPUT_PPPS v) : COLOR {
float4 color = float4(1.0,1.0,1.0,1.0);
return color;
}


With the type 1 shader I see these errors:

Direct3D9: :====> ENTER: DLLMAIN(011ed6e0): Process Detach 00000958, tid=00000ab0
Direct3D9: (INFO) :MemFini!
Direct3D9: (WARN) :Memory still allocated! Alloc count = 288
Direct3D9: (WARN) :Current Process (pid) = 00000958
Direct3D9: (WARN) :Memory Address: 00c55050 lAllocID=1 dwSize=000047f8, (pid=00000958)
Direct3D9: (WARN) : Stack Back Trace
Direct3D9: (ERROR) : [0] : Address 011ED4CB
Direct3D9: (ERROR) : [1] : Address 011ED59B
Direct3D9: (ERROR) : [2] : Address 011ED440
Direct3D9: (ERROR) : [3] : Address 011E1D44
Direct3D9: (ERROR) : [4] : Address 0044A55E
Direct3D9: (ERROR) : [5] : Address 00401044
Direct3D9: (ERROR) : [6] : Address 00401CC4
Direct3D9: (ERROR) : [7] : Address 00404774
Direct3D9: (ERROR) : [8] : Address 77E8141A
Direct3D9: (ERROR) : [9] : Address 00000000
Direct3D9: (ERROR) : [10] : Address 00000000
Direct3D9: (ERROR) : [11] : Address 00000000
Direct3D9: (ERROR) : [12] : Address 00000000
Direct3D9: (ERROR) : [13] : Address 00000000
Direct3D9: (ERROR) : [14] : Address 00000000
Direct3D9: (ERROR) : [15] : Address 00000000
Direct3D9: (WARN) :Memory Address: 00c5b0b0 lAllocID=9 dwSize=000010e0, (pid=00000958)
Direct3D9: (WARN) : Stack Back Trace
Direct3D9: (ERROR) : [0] : Address 011E4064
Direct3D9: (ERROR) : [1] : Address 011E4E4F
Direct3D9: (ERROR) : [2] : Address 011E5588
Direct3D9: (ERROR) : [3] : Address 011E1D65
Direct3D9: (ERROR) : [4] : Address 0044A55E
Direct3D9: (ERROR) : [5] : Address 00401044
Direct3D9: (ERROR) : [6] : Address 00401CC4
Direct3D9: (ERROR) : [7] : Address 00404774
Direct3D9: (ERROR) : [8] : Address 77E8141A
Direct3D9: (ERROR) : [9] : Address 00000000
Direct3D9: (ERROR) : [10] : Address 00000000
Direct3D9: (ERROR) : [11] : Address 00000000
Direct3D9: (ERROR) : [12] : Address 00000000
Direct3D9: (ERROR) : [13] : Address 00000000
Direct3D9: (ERROR) : [14] : Address 00000000
Direct3D9: (ERROR) : [15] : Address 00000000
Direct3D9: (WARN) :Memory Address: 00c52e58 lAllocID=10 dwSize=00000008, (pid=00000958)
Direct3D9: (WARN) : Stack Back Trace
Direct3D9: (ERROR) : [0] : Address 011E4152
Direct3D9: (ERROR) : [1] : Address 011E4E4F
Direct3D9: (ERROR) : [2] : Address 011E5588
Direct3D9: (ERROR) : [3] : Address 011E1D65
Direct3D9: (ERROR) : [4] : Address 0044A55E
Direct3D9: (ERROR) : [5] : Address 00401044
Direct3D9: (ERROR) : [6] : Address 00401CC4
Direct3D9: (ERROR) : [7] : Address 00404774
Direct3D9: (ERROR) : [8] : Address 77E8141A
Direct3D9: (ERROR) : [9] : Address 00000000
Direct3D9: (ERROR) : [10] : Address 00000000
Direct3D9: (ERROR) : [11] : Address 00000000
Direct3D9: (ERROR) : [12] : Address 00000000
Direct3D9: (ERROR) : [13] : Address 00000000
Direct3D9: (ERROR) : [14] : Address 00000000
Direct3D9: (ERROR) : [15] : Address 00000000


With the type 2 shader I don't get those, so it tells me that something is wrong with the way my samplers are set up. This still doesn;t fix the fact that the shader is not being executed at all, but it might be a start.

Does anyone know what's wrong with my samplers? Or why the shader won't execute at all?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this