Jump to content
  • Advertisement
Sign in to follow this  
pcmaster

DX11 DX11 Dynamic Linking compilation warnings

This topic is 2693 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi everyone!

We're experimenting with DX11 dynamic linking and ran into some weird warnings, leading to errors.
Has anyone any explanation for these? The internal error, for example, isn't very helpful :( When we inline the code from GetBias, some of the warnings disappear.

See below.


// WARNING X3578 HERE, line 246
float GetBias(const float2 depthGrad, const float2 offset) {
return dot(depthGrad, offset);
}

interface iShadowType {
float getShadow(const float2 depthGrad, const float2 uv);
};

class cShadowTypeNone : iShadowType {
// WARNING X3578, line 258
float getShadow(const float2 depthGrad, const float2 uv) {
return 1;
}
};

class cShadowTypePCF : iShadowType {
float getShadow(const float2 depthGrad, const float2 uv) {
float offset = 1;
float sum = 0;
if (uv.x == 1) {
float bias = GetBias(depthGrad, offset);
float shadow = shadowMap.SampleCmpLevelZero(sampCmpShadowMap, uv + offset, bias);
sum += shadow;
}
else
sum += 1;
return sum;
}
};

iShadowType shadowType;

cbuffer cbShadowType {
cShadowTypeNone shadowTypeNoneInstance;
cShadowTypePCF shadowTypePCFInstance;
};


interface iShadowShader {
float getShadow(const float2 depthGrad, const float2 uv);
};

class cShadowNone : iShadowShader {
float getShadow(const float2 depthGrad, const float2 uv) {
return 1;
}
};

class cShadowNoPCSS : iShadowShader {
float getShadow(const float2 depthGrad, const float2 uv) {
return shadowType.getShadow(depthGrad, uv);
}
};

iShadowShader shadowShader;

cbuffer cbShadowShader {
cShadowNone shadowNoneInstance;
cShadowNoPCSS shadowNoPCSSInstance;
};


The compilation log:

dynamicShadow.fxh(246,7): warning X3578: Output value 'GetBias' is not completely initialized
dynamicShadow.fxh(246,7): warning X3578: Output value 'GetBias' is not completely initialized
internal error: no storage type for block output
dynamicShadow.fxh(246,7): warning X3578: Output value 'GetBias' is not completely initialized
dynamicShadow.fxh(258,8): warning X3578: Output value 'cShadowTypeNone::getShadow' is not completely initialized
shading.fx(310,19): There was an error compiling expression

Share this post


Link to post
Share on other sites
Advertisement
OK, here we go. We fabricated this small sample, the errors are there.

Texture2D shadowMap;

SamplerComparisonState sampCmpShadowMap
{
Filter = COMPARISON_MIN_MAG_LINEAR_MIP_POINT;
AddressU = Border;
AddressV = Border;
BorderColor = float4(1.0, 1.0, 1.0, 1.0);
ComparisonFunc = LESS;
};

float GetBias(const float2 depthGrad, const float2 offset)
{
return dot(depthGrad, offset);
}

interface iShadowType
{
float getShadow(const float2 depthGrad, const float2 uv);
};

class cShadowTypeNone : iShadowType
{
float getShadow(const float2 depthGrad, const float2 uv)
{
return 1;
}
};

class cShadowTypePCF : iShadowType
{
float getShadow(const float2 depthGrad, const float2 uv)
{
float offset = 1;
float sum = 0;
if (uv.x == 1)
{
float bias = GetBias(depthGrad, offset);
float shadow = shadowMap.SampleCmpLevelZero(sampCmpShadowMap, uv + offset, bias);
sum += shadow;
}
else
sum += 1;
return sum;
}
};

iShadowType shadowType;

cbuffer cbShadowType
{
cShadowTypeNone shadowTypeNoneInstance;
cShadowTypePCF shadowTypePCFInstance;
};


interface iShadowShader
{
float getShadow(const float2 depthGrad, const float2 uv);
};

class cShadowNone : iShadowShader
{
float getShadow(const float2 depthGrad, const float2 uv)
{
return 1;
}
};

class cShadowNoPCSS : iShadowShader
{
float getShadow(const float2 depthGrad, const float2 uv)
{
return shadowType.getShadow(depthGrad, uv);
}
};

iShadowShader shadowShader;

cbuffer cbShadowShader
{
cShadowNone shadowNoneInstance;
cShadowNoPCSS shadowNoPCSSInstance;
};

float4 VS(float4 pos : SV_Position) : SV_Position
{
return pos;
}

float PS(float4 pos : SV_Position) : SV_Target
{
return shadowShader.getShadow(pos.xy, pos.zw);
}

technique10 Shading
{
pass P0
{
SetBlendState( NULL, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF );
SetDepthStencilState( NULL, 0 );
SetRasterizerState( NULL );

SetVertexShader( CompileShader( vs_5_0, VS() ) );
SetGeometryShader( NULL );
SetPixelShader( CompileShader( ps_5_0, PS() ) );
}
}





And this is how you can compile it and what it'd say, to demonstrate the replicability.


c:\effects>"%DXSDK_DIR%/Utilities/Bin/x64/fxc.exe" /Ges /O3 /T fx_5_0 /nologo /Fo "compiled/Sample.fxo" Sample.fx
c:\effects\Sample.fx(12,7): warning X3578: Output value 'GetBias' is not completely initialized
c:\effects\Sample.fx(12,7): warning X3578: Output value 'GetBias' is not completely initialized
internal error: no storage type for block output
c:\effects\Sample.fx(12,7): warning X3578: Output value 'GetBias' is not completely initialized
c:\effects\Sample.fx(24,8): warning X3578: Output value 'cShadowTypeNone::getShadow' is not completely initialized
c:\effects\Sample.fx(106,19): There was an error compiling expression

compilation failed; no code produced



Share this post


Link to post
Share on other sites
MS does know about it now :) It is a compiler bug (possibly more than one) and so you'll have to work around it for the time being. There may be some recommendations later once someone has looked at the issue.

Share this post


Link to post
Share on other sites
Well, the feature isn't useless, it's just that you've tripped a bug. I'm not sure yet what the exact issue is since the current bits here don't repro the issue - so it seems that it was fixed at some point. You can however use functions and and interfaces together. It may just be an issue with types or perhaps with placement within the shader so a slight reorganization or perhaps an alternate method of doing the same thing will result in a working shader. It may also work fine on a different optimization level.

Share this post


Link to post
Share on other sites
I'm running into this problem right now with the June 2010 DirectX SDK. Did you find a good workaround for this problem? If so, what did you do? I think we're overdue for a new SDK release.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!