sharpdx / SharpDX

SharpDX GitHub Repository
http://sharpdx.org
MIT License
1.69k stars 640 forks source link

Not possible to get signature for shader with TextureCube using Direct3D11.Effects #615

Open QuantumDeveloper opened 9 years ago

QuantumDeveloper commented 9 years ago

I am trying to compile and use test skybox shader, but Icode if failing with E_FAIL/unspecified error when I am trying to get pass sugnature.

Here is my code:

var skyboxByteCode = ShaderBytecode.CompileFromFile(@"Content\Effects\SkyboxEffect.fx", "fx_5_0", ShaderFlags.IeeeStrictness | ShaderFlags.OptimizationLevel2);
         var skyboxEffect = new Effect(GraphicsDevice, skyboxByteCode);
         pass = customEffect.GetTechniqueByName("Skybox").GetPassByIndex(0);
         var sign = pass.Description.Signature;

Code is failing on that line:

var sign = pass.Description.Signature;

Here is my shader code:

matrix worldMatrix;
matrix viewMatrix;
matrix projectionMatrix;

TextureCube skyboxTexture;
SamplerState skyBoxSampler;

struct VertexShaderInput
{
   float4 position : SV_POSITION;
   float4 color: COLOR;
   float3 normal : NORMAL;
   float2 tex : TEXCOORD0;
   float4 tan : TANGENT;
};

struct VertexShaderOutput
{
   float4 position : SV_POSITION;
   float4 color: COLOR;
   float3 normal : NORMAL;
   float3 tex : TEXCOORD0;
};

VertexShaderOutput VertexShaderFunction(VertexShaderInput input)
{
   VertexShaderOutput output;

   output.position = mul(input.position, worldMatrix);
   output.position = mul(output.position, viewMatrix);
   output.position = mul(output.position, projectionMatrix);

   output.tex = float3(input.tex, 0);
   return output;
}

float4 PixelShaderFunction(VertexShaderOutput input) : SV_TARGET
{
   return skyboxTexture.Sample(skyBoxSampler, input.tex);

   /*GrayScale shader
   float4 Color = skyboxTexture.Sample(skyBoxSampler, input.TextureCoordinate);
   Color.xyz = dot(Color.xyz, float3(0.3, 0.59, 0.11));
   return Color;
   */
}

technique Skybox
{
   pass Pass0
   {
      SetVertexShader(CompileShader(vs_4_0, VertexShaderFunction()));
      SetPixelShader(CompileShader(ps_4_0, PixelShaderFunction()));
   }
}

As far as it is compiling without errors, I suppose, shader is OK, but I cannot understand why I cannot get it signature when another simзle shader for Texture2D is working correctly?

QuantumDeveloper commented 9 years ago

P.S. I am using latest binaries alpha 002