DX11 Dynamic Linking compilation warnings

Started by
9 comments, last by s-m-i-s-e-k 13 years, 1 month ago
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 246float 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 initializeddynamicShadow.fxh(246,7): warning X3578: Output value 'GetBias' is not completely initializedinternal error: no storage type for block outputdynamicShadow.fxh(246,7): warning X3578: Output value 'GetBias' is not completely initializeddynamicShadow.fxh(258,8): warning X3578: Output value 'cShadowTypeNone::getShadow' is not completely initializedshading.fx(310,19): There was an error compiling expression
Advertisement
Looks like a compiler bug. Which SDK are you using?
June 2010, didn't try February.
Could you post a complete repro that compiles and compiler options that you used? The repro can be a minimum one.
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.fxc:\effects\Sample.fx(12,7): warning X3578: Output value 'GetBias' is not completely initializedc:\effects\Sample.fx(12,7): warning X3578: Output value 'GetBias' is not completely initializedinternal error: no storage type for block outputc:\effects\Sample.fx(12,7): warning X3578: Output value 'GetBias' is not completely initializedc:\effects\Sample.fx(24,8): warning X3578: Output value 'cShadowTypeNone::getShadow' is not completely initializedc:\effects\Sample.fx(106,19): There was an error compiling expressioncompilation failed; no code produced
Nobody has any clue, yet? :( Should we report this directly to Microsoft and try discussing it at their forums?
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.
Awesome :D So it's pretty much useless for now. Thanks anyway
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.
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.

This topic is closed to new replies.

Advertisement