Updated StockShaderCodeGenerator and EffectProcessor to support DX11 stock shaders (wrong profile was used while compiling).
This commit is contained in:
parent
ef4cb698e4
commit
786934191d
@ -48,21 +48,21 @@ namespace ANX.Framework.Content.Pipeline.Processors
|
||||
{
|
||||
byte[] effectCompiledCode = null;
|
||||
|
||||
if (input.SourceLanguage == NonXNA.EffectSourceLanguage.HLSL_FX)
|
||||
switch (input.SourceLanguage)
|
||||
{
|
||||
HLSLCompiler compiler = hlslCompilerFactory.Compilers.Last<HLSLCompiler>();
|
||||
effectCompiledCode = compiler.Compile(input.EffectCode, DebugMode, TargetProfile);
|
||||
}
|
||||
else if (input.SourceLanguage == NonXNA.EffectSourceLanguage.GLSL_FX)
|
||||
{
|
||||
//TODO: parse and split the effect code and save two effect globs
|
||||
// if we do it this way, we don't need to parse the glsl source at runtime when loading it.
|
||||
case NonXNA.EffectSourceLanguage.HLSL_FX:
|
||||
HLSLCompiler compiler = hlslCompilerFactory.Compilers.Last<HLSLCompiler>();
|
||||
effectCompiledCode = compiler.Compile(input.EffectCode, DebugMode, TargetProfile);
|
||||
break;
|
||||
case NonXNA.EffectSourceLanguage.GLSL_FX:
|
||||
//TODO: parse and split the effect code and save two effect globs
|
||||
// if we do it this way, we don't need to parse the glsl source at runtime when loading it.
|
||||
|
||||
effectCompiledCode = ShaderHelper.SaveShaderCode(input.EffectCode);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidContentException("EffectProcessor is unable to process content with format '" + input.SourceLanguage.ToString() + "'");
|
||||
effectCompiledCode = ShaderHelper.SaveShaderCode(input.EffectCode);
|
||||
break;
|
||||
default:
|
||||
throw new InvalidContentException("EffectProcessor is unable to process content with format '" + input.SourceLanguage.ToString() + "'");
|
||||
break;
|
||||
}
|
||||
|
||||
return new CompiledEffectContent(effectCompiledCode)
|
||||
|
@ -72,7 +72,7 @@ namespace ANX.RenderSystem.Windows.DX11
|
||||
{
|
||||
NativeEffect = new Dx11.Effect(device, GetByteCode(effectStream));
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (SharpDX.SharpDXException ex)
|
||||
{
|
||||
System.Diagnostics.Debugger.Break();
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -71,9 +71,9 @@
|
||||
<Project>{068eb2e9-963c-4e1b-8831-e25011f11ffe}</Project>
|
||||
<Name>ANX.PlatformSystem.Windows</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\RenderSystems\ANX.RenderSystem.Windows.DX10\ANX.RenderSystem.Windows.DX10.csproj">
|
||||
<Project>{5be49183-2f6f-4527-ac90-d816911fcf90}</Project>
|
||||
<Name>ANX.RenderSystem.Windows.DX10</Name>
|
||||
<ProjectReference Include="..\..\RenderSystems\ANX.RenderSystem.Windows.DX11\ANX.RenderSystem.Windows.DX11.csproj">
|
||||
<Project>{b30de9c2-0926-46b6-8351-9af276c472d5}</Project>
|
||||
<Name>ANX.RenderSystem.Windows.DX11</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\SoundSystems\ANX.SoundSystem.Windows.XAudio\ANX.SoundSystem.Windows.XAudio.csproj">
|
||||
<Project>{6a582788-c4d2-410c-96cd-177f75712d65}</Project>
|
||||
|
@ -65,11 +65,11 @@ namespace StockShaderCodeGenerator
|
||||
switch (RenderSystem)
|
||||
{
|
||||
case "ANX.RenderSystem.Windows.DX10":
|
||||
byteCode = CompileDXEffect(sourceCode, directory);
|
||||
byteCode = CompileDXEffect(sourceCode, directory, EffectSourceLanguage.HLSL_FX ,"fx_4_0");
|
||||
break;
|
||||
|
||||
case "ANX.RenderSystem.Windows.DX11":
|
||||
byteCode = CompileDXEffect(sourceCode, directory);
|
||||
byteCode = CompileDXEffect(sourceCode, directory, EffectSourceLanguage.HLSL_FX, "fx_5_0");
|
||||
break;
|
||||
|
||||
case "ANX.RenderSystem.Windows.Metro":
|
||||
@ -89,17 +89,18 @@ namespace StockShaderCodeGenerator
|
||||
return byteCode;
|
||||
}
|
||||
|
||||
private static byte[] CompileDXEffect(string sourceCode, string directory)
|
||||
private static byte[] CompileDXEffect(string sourceCode, string directory, EffectSourceLanguage sourceLanguage, String targetProfile)
|
||||
{
|
||||
EffectContent effectContent = new EffectContent()
|
||||
{
|
||||
EffectCode = sourceCode,
|
||||
Identity = new ContentIdentity(null, "StockShaderCodeGenerator", null),
|
||||
SourceLanguage = EffectSourceLanguage.HLSL_FX,
|
||||
SourceLanguage = sourceLanguage,
|
||||
};
|
||||
|
||||
BuildContent buildContentTask = new BuildContent();
|
||||
IContentProcessor instance = buildContentTask.ProcessorManager.GetInstance("EffectProcessor");
|
||||
((EffectProcessor)instance).TargetProfile = targetProfile;
|
||||
CompiledEffectContent effect = instance.Process(effectContent, null) as CompiledEffectContent;
|
||||
|
||||
return effect.GetEffectCode();
|
||||
|
Loading…
x
Reference in New Issue
Block a user