Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualJoakim1234

Posted 27 July 2012 - 07:21 PM

When I call
D3DX11CompileFromFile(pixelShaderPath, NULL, NULL, "SpritePixelShader", "vs_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0, NULL, &pixelShaderBuffer, NULL, NULL);
I get the error message:

Unexpected error encountered
Error Code: E_FAIL(0x80004005)
Calling: D3DX11CompileFromFile(pixelShaderPath, NULL, NULL, "SpritePixelShader", "vs_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0, NULL, &pixelShaderBuffer, NULL, NULL)

The D3DX11CompileFromFile(vertexShaderPath, NULL, NULL, "SpriteVertexShader", "vs_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0, NULL, &vertexShaderBuffer, NULL, NULL) function doesn't cause an error,but on the next 2 lines where I call CreateVertexShader and CreatePixelShader, CreateVertexShader does cause an error:

Unexpected error encountered
Error Code: E_INVALIDARG(0x80070057)
Calling: CreateVertexShader(vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), NULL, &vertexShader))

Which brings me to believe,that D3DX11CompileFromFile(vertexShaderPath, NULL, NULL, "SpriteVertexShader", "vs_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0, NULL, &vertexShaderBuffer, NULL, NULL) also didn't work out very well.All the pointers are initialized properly before calling these functions,so that can't be it:
vertexShader = 0;
pixelShader = 0;
vertexShaderBuffer = 0;
pixelShaderBuffer = 0;
And it can't be from not finding the SpriteEffect.vs and SpriteEffect.ps files,they're right next to the source files,I also copied them in the debug folder to be next to the .exe just in case.Could the problem be invalid code in the shader files themselves?They're just a simple instanced geometry/bump map effect:
cbuffer MatrixBuffer
{
matrix worldMatrix;
matrix viewMatrix;
matrix projectionMatrix;
};
struct VertexInputType
{
	float4 position : POSITION;
	float2 tex : TEXCOORD0;
float3 normal : NORMAL;
float3 tangent : TANGENT;
float3 binormal : BINORMAL;
float3 instancePosition : TEXCOORD1;
};
struct PixelInputType
{
	float4 position : SV_POSITION;
	float2 tex : TEXCOORD0;
	float3 normal : NORMAL;
float3 tangent : TANGENT;
float3 binormal : BINORMAL;
};
PixelInputType SpriteVertexShader(VertexInputType input)
{
	PixelInputType output;
  
	input.position.w = 1.0f;
	input.position.x += input.instancePosition.x;
	input.position.y += input.instancePosition.y;
	input.position.z += input.instancePosition.z;
	output.position = mul(input.position, worldMatrix);
	output.position = mul(output.position, viewMatrix);
	output.position = mul(output.position, projectionMatrix);
  
output.tex = input.tex;
	output.normal = mul(input.normal, (float3x3)worldMatrix);
	output.normal = normalize(output.normal);
	output.tangent = mul(input.tangent, (float3x3)worldMatrix);
	output.tangent = normalize(output.tangent);
	output.binormal = mul(input.binormal, (float3x3)worldMatrix);
	output.binormal = normalize(output.binormal);
  
	return output;
}

Texture2D shaderTexture;


SamplerState SampleType;
struct PixelInputType
{
float4 position : SV_POSITION;
float2 tex : TEXCOORD0;
float3 normal : NORMAL;
float3 tangent : TANGENT;
float3 binormal : BINORMAL;
};
float4 SpritePixelShader(PixelInputType input) : SV_TARGET
{
float4 textureColor;
float4 bumpMap;
float3 bumpNormal;
float3 lightDir;
float lightIntensity;
float4 color;
textureColor = shaderTextures[0].Sample(SampleType, input.tex);

bumpMap = shaderTextures[1].Sample(SampleType, input.tex);
bumpMap = (bumpMap * 2.0f) - 1.0f;

bumpNormal = input.normal + bumpMap.x * input.tangent + bumpMap.y * input.binormal;

bumpNormal = normalize(bumpNormal);
lightDir = -lightDirection;
lightIntensity = saturate(dot(bumpNormal, lightDir));
color = saturate(diffuseColor * lightIntensity);
color = color * textureColor;

return color;
}
I don't have syntax highlighting for HLSL,so it's possible that I missed something stupid.Any help would be appreciated.

#3Joakim1234

Posted 27 July 2012 - 01:25 PM

When I call
D3DX11CompileFromFile(pixelShaderPath, NULL, NULL, "SpritePixelShader", "vs_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0, NULL, &pixelShaderBuffer, NULL, NULL);
I get the error message:

Unexpected error encountered
Error Code: E_FAIL(0x80004005)
Calling: D3DX11CompileFromFile(pixelShaderPath, NULL, NULL, "SpritePixelShader", "vs_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0, NULL, &pixelShaderBuffer, NULL, NULL)

The D3DX11CompileFromFile(vertexShaderPath, NULL, NULL, "SpriteVertexShader", "vs_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0, NULL, &vertexShaderBuffer, NULL, NULL) function doesn't cause an error,but on the next 2 lines where I call CreateVertexShader and CreatePixelShader, CreateVertexShader does cause an error:

Unexpected error encountered
Error Code: E_INVALIDARG(0x80070057)
Calling: CreateVertexShader(vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), NULL, &vertexShader))

Which brings me to believe,that D3DX11CompileFromFile(vertexShaderPath, NULL, NULL, "SpriteVertexShader", "vs_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0, NULL, &vertexShaderBuffer, NULL, NULL) also didn't work out very well.All the pointers are initialized properly before calling these functions,so that can't be it:
vertexShader = 0;
pixelShader = 0;
vertexShaderBuffer = 0;
pixelShaderBuffer = 0;
And it can't be from not finding the SpriteEffect.vs and SpriteEffect.ps files,they're right next to the source files,I also copied them in the debug folder to be next to the .exe just in case.Could the problem be invalid code in the shader files themselves?They're just a simple instanced geometry/bump map effect:
cbuffer MatrixBuffer
{
matrix worldMatrix;
matrix viewMatrix;
matrix projectionMatrix;
};
struct VertexInputType
{
	float4 position : POSITION;
	float2 tex : TEXCOORD0;
float3 normal : NORMAL;
float3 tangent : TANGENT;
float3 binormal : BINORMAL;
float3 instancePosition : TEXCOORD1;
};
struct PixelInputType
{
	float4 position : SV_POSITION;
	float2 tex : TEXCOORD0;
	float3 normal : NORMAL;
float3 tangent : TANGENT;
float3 binormal : BINORMAL;
};
PixelInputType SpriteVertexShader(VertexInputType input)
{
	PixelInputType output;
   
	input.position.w = 1.0f;
	input.position.x += input.instancePosition.x;
	input.position.y += input.instancePosition.y;
	input.position.z += input.instancePosition.z;
	output.position = mul(input.position, worldMatrix);
	output.position = mul(output.position, viewMatrix);
	output.position = mul(output.position, projectionMatrix);
   
output.tex = input.tex;
	output.normal = mul(input.normal, (float3x3)worldMatrix);
	output.normal = normalize(output.normal);
	output.tangent = mul(input.tangent, (float3x3)worldMatrix);
	output.tangent = normalize(output.tangent);
	output.binormal = mul(input.binormal, (float3x3)worldMatrix);
	output.binormal = normalize(output.binormal);
   
	return output;
}

Texture2D shaderTexture;


SamplerState SampleType;
struct PixelInputType
{
float4 position : SV_POSITION;
float2 tex : TEXCOORD0;
float3 normal : NORMAL;
float3 tangent : TANGENT;
float3 binormal : BINORMAL;
};
float4 SpritePixelShader(PixelInputType input) : SV_TARGET
{
float4 textureColor;
float4 bumpMap;
float3 bumpNormal;
float3 lightDir;
float lightIntensity;
float4 color;
textureColor = shaderTextures[0].Sample(SampleType, input.tex);

bumpMap = shaderTextures[1].Sample(SampleType, input.tex);
bumpMap = (bumpMap * 2.0f) - 1.0f;

bumpNormal = input.normal + bumpMap.x * input.tangent + bumpMap.y * input.binormal;

bumpNormal = normalize(bumpNormal);
lightDir = -lightDirection;
lightIntensity = saturate(dot(bumpNormal, lightDir));
color = saturate(diffuseColor * lightIntensity);
color = color * textureColor;

return color;
}
I don't have syntax highlighting for HLSL,so it's possible that I missed something stupid.Any help would be appreciated.

#2Joakim1234

Posted 27 July 2012 - 01:24 PM

When I call
D3DX11CompileFromFile(pixelShaderPath, NULL, NULL, "SpritePixelShader", "vs_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0, NULL, &pixelShaderBuffer, NULL, NULL);
I get the error message:

Unexpected error encountered
Error Code: E_FAIL(0x80004005)
Calling: D3DX11CompileFromFile(pixelShaderPath, NULL, NULL, "SpritePixelShader", "vs_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0, NULL, &pixelShaderBuffer, NULL, NULL)

The D3DX11CompileFromFile(vertexShaderPath, NULL, NULL, "SpriteVertexShader", "vs_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0, NULL, &vertexShaderBuffer, NULL, NULL) function doesn't cause an error,but on the next 2 lines where I call CreateVertexShader and CreatePixelShader, CreateVertexShader does cause an error:

Unexpected error encountered
Error Code: E_INVALIDARG(0x80070057)
Calling: CreateVertexShader(vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), NULL, &vertexShader))

Which brings me to believe,that D3DX11CompileFromFile(vertexShaderPath, NULL, NULL, "SpriteVertexShader", "vs_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0, NULL, &vertexShaderBuffer, NULL, NULL) also didn't work out very well.All the pointers are initialized properly before calling these functions,so that can't be it:
vertexShader = 0;
pixelShader = 0;
vertexShaderBuffer = 0;
pixelShaderBuffer = 0;
And it can't be from not finding the SpriteEffect.vs and SpriteEffect.ps files,they're right next to the source files,I also copied them in the debug folder to be next to the .exe just in case.Could the problem be invalid code in the shader files themselves?They're just a simple instanced geometry/bump map effect:
cbuffer MatrixBuffer
{
matrix worldMatrix;
matrix viewMatrix;
matrix projectionMatrix;
};
struct VertexInputType
{
	float4 position : POSITION;
	float2 tex : TEXCOORD0;
float3 normal : NORMAL;
float3 tangent : TANGENT;
float3 binormal : BINORMAL;
float3 instancePosition : TEXCOORD1;
};
struct PixelInputType
{
	float4 position : SV_POSITION;
	float2 tex : TEXCOORD0;
	float3 normal : NORMAL;
float3 tangent : TANGENT;
float3 binormal : BINORMAL;
};
PixelInputType SpriteVertexShader(VertexInputType input)
{
	PixelInputType output;
   
	input.position.w = 1.0f;
	input.position.x += input.instancePosition.x;
	input.position.y += input.instancePosition.y;
	input.position.z += input.instancePosition.z;
	output.position = mul(input.position, worldMatrix);
	output.position = mul(output.position, viewMatrix);
	output.position = mul(output.position, projectionMatrix);
   
output.tex = input.tex;
	output.normal = mul(input.normal, (float3x3)worldMatrix);
	output.normal = normalize(output.normal);
	output.tangent = mul(input.tangent, (float3x3)worldMatrix);
	output.tangent = normalize(output.tangent);
	output.binormal = mul(input.binormal, (float3x3)worldMatrix);
	output.binormal = normalize(output.binormal);
   
	return output;
}

Texture2D shaderTexture;


SamplerState SampleType;
struct PixelInputType
{
float4 position : SV_POSITION;
float2 tex : TEXCOORD0;
float3 normal : NORMAL;
float3 tangent : TANGENT;
float3 binormal : BINORMAL;
};
float4 SpritePixelShader(PixelInputType input) : SV_TARGET
{
float4 textureColor;
float4 bumpMap;
float3 bumpNormal;
float3 lightDir;
float lightIntensity;
float4 color;
textureColor = shaderTextures[0].Sample(SampleType, input.tex);

bumpMap = shaderTextures[1].Sample(SampleType, input.tex);
bumpMap = (bumpMap * 2.0f) - 1.0f;

bumpNormal = input.normal + bumpMap.x * input.tangent + bumpMap.y * input.binormal;

bumpNormal = normalize(bumpNormal);
lightDir = -lightDirection;
lightIntensity = saturate(dot(bumpNormal, lightDir));
color = saturate(diffuseColor * lightIntensity);
color = color * textureColor;

return color;
}
I don't have syntax highlighting for HLSL,so it's possible that I missed something stupid.Any help would be appreciated.

#1Joakim1234

Posted 27 July 2012 - 01:24 PM

When I call
D3DX11CompileFromFile(pixelShaderPath, NULL, NULL, "SpritePixelShader", "vs_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0, NULL, &pixelShaderBuffer, NULL, NULL);
I get the error message:

Unexpected error encountered
Error Code: E_FAIL(0x80004005)
Calling: D3DX11CompileFromFile(pixelShaderPath, NULL, NULL, "SpritePixelShader", "vs_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0, NULL, &pixelShaderBuffer, NULL, NULL)

The D3DX11CompileFromFile(vertexShaderPath, NULL, NULL, "SpriteVertexShader", "vs_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0, NULL, &vertexShaderBuffer, NULL, NULL) function doesn't cause an error,but on the next 2 lines where I call CreateVertexShader and CreatePixelShader, CreateVertexShader does cause an error:

Unexpected error encountered
Error Code: E_INVALIDARG(0x80070057)
Calling: CreateVertexShader(vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), NULL, &vertexShader))

Which brings me to believe,that D3DX11CompileFromFile(vertexShaderPath, NULL, NULL, "SpriteVertexShader", "vs_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0, NULL, &vertexShaderBuffer, NULL, NULL) also didn't work out very well.All the pointers are initialized properly before calling these functions,so that can't be it:
vertexShader = 0;
pixelShader = 0;
vertexShaderBuffer = 0;
pixelShaderBuffer = 0;
And it can't be from not finding the SpriteEffect.vs and SpriteEffect.ps files,they're right next to the source files,I also copied them in the debug folder to be next to the .exe just in case.Could the problem be invalid code in the shader files themselves?They're just a simple instanced geometry/bump map effect:
cbuffer MatrixBuffer
{
matrix worldMatrix;
matrix viewMatrix;
matrix projectionMatrix;
};
struct VertexInputType
{
    float4 position : POSITION;
    float2 tex : TEXCOORD0;
float3 normal : NORMAL;
float3 tangent : TANGENT;
float3 binormal : BINORMAL;
float3 instancePosition : TEXCOORD1;
};
struct PixelInputType
{
    float4 position : SV_POSITION;
    float2 tex : TEXCOORD0;
    float3 normal : NORMAL;
float3 tangent : TANGENT;
float3 binormal : BINORMAL;
};
PixelInputType SpriteVertexShader(VertexInputType input)
{
    PixelInputType output;
   
    input.position.w = 1.0f;
    input.position.x += input.instancePosition.x;
    input.position.y += input.instancePosition.y;
    input.position.z += input.instancePosition.z;
    output.position = mul(input.position, worldMatrix);
    output.position = mul(output.position, viewMatrix);
    output.position = mul(output.position, projectionMatrix);
   
output.tex = input.tex;
    output.normal = mul(input.normal, (float3x3)worldMatrix);
    output.normal = normalize(output.normal);
    output.tangent = mul(input.tangent, (float3x3)worldMatrix);
    output.tangent = normalize(output.tangent);
    output.binormal = mul(input.binormal, (float3x3)worldMatrix);
    output.binormal = normalize(output.binormal);
   
    return output;
}

Texture2D shaderTexture;


SamplerState SampleType;
struct PixelInputType
{
float4 position : SV_POSITION;
float2 tex : TEXCOORD0;
float3 normal : NORMAL;
float3 tangent : TANGENT;
float3 binormal : BINORMAL;
};
float4 SpritePixelShader(PixelInputType input) : SV_TARGET
{
float4 textureColor;
float4 bumpMap;
float3 bumpNormal;
float3 lightDir;
float lightIntensity;
float4 color;
textureColor = shaderTextures[0].Sample(SampleType, input.tex);

bumpMap = shaderTextures[1].Sample(SampleType, input.tex);
bumpMap = (bumpMap * 2.0f) - 1.0f;

bumpNormal = input.normal + bumpMap.x * input.tangent + bumpMap.y * input.binormal;

bumpNormal = normalize(bumpNormal);
lightDir = -lightDirection;
lightIntensity = saturate(dot(bumpNormal, lightDir));
color = saturate(diffuseColor * lightIntensity);
color = color * textureColor;

return color;
}
I don't have syntax highlighting for HLSL,so it's possible that I missed something stupid.Any help would be appreciated.

PARTNERS