Jump to content
  • Advertisement

BigWordFree

Member
  • Content Count

    5
  • Joined

  • Last visited

Community Reputation

100 Neutral

About BigWordFree

  • Rank
    Newbie
  1. BigWordFree

    [SlimDX - DX11] Setting Shader Variables...

    Thanks for your guys help, I'm from DX9 really and just trying to get the hang of DX11, for down the road implementation of my programs. So much different. Does anyone have an example anywhere on the net for implementing Effect files with SlimDX11, I had trouble finding such an article when searching. If not, I'll just keep experimenting around and see if I can get it to work.
  2. BigWordFree

    [SlimDX - DX11] Setting Shader Variables...

    Thanks guys for the replies, what is a constant buffer and the slot it's asking for? How do I obtain the constant buffer and the slot must be zero for my example I assume. It's asking for a SlimDX.D3D11.Buffer. But I don't know what or where to obtain it. I just want to set the wvp matrix in the shader. But here's the deal. Both the vertex and pixel shaders both reside in the same file and the entry point that I supplied for both shaders was the name of the shader, so I assume that both shaders don't include any of the global variables? Or do they both have the globals? Here's the code I have to create the shaders: this.vertexShaderByteCode = SlimDX.D3DCompiler.ShaderBytecode.CompileFromFile(fi.FullName, "VShader", "vs_4_0", SlimDX.D3DCompiler.ShaderFlags.None, SlimDX.D3DCompiler.EffectFlags.None); this.inputSignature = SlimDX.D3DCompiler.ShaderSignature.GetInputSignature(this.vertexShaderByteCode); this.vertexShader = new VertexShader(this.Device, this.vertexShaderByteCode); this.pixelShaderByteCode = SlimDX.D3DCompiler.ShaderBytecode.CompileFromFile(fi.FullName, "PShader", "ps_4_0", SlimDX.D3DCompiler.ShaderFlags.None, SlimDX.D3DCompiler.EffectFlags.None); this.pixelShader = new PixelShader(this.Device, this.pixelShaderByteCode);
  3. I'm having a hell of a time setting shader variables. I have an FX file: float4x4 wvp; struct vdata { float4 p0 : POSITION0; float4 c0 : COLOR0; }; struct pdata { float4 po : SV_POSITION; float4 c0 : COLOR0; }; vdata VShader(vdata i) { vdata o; o.p0 = mul(i.p0, wvp);//position o.c0 = i.c0; return o; } float4 PShader(pdata i) : SV_Target { return i.c0; } technique Render { pass Pass0 { SetVertexShader(CompileShader(vs_5_0, VShader())); SetPixelShader (CompileShader(ps_5_0, PShader())); } } and there's the code, remember I just want to set the wvp variable. How can I? Please help and how to give rep pts, I can't seem to find the button and some have been nice to me. -Andrew
  4. BigWordFree

    [SlimDX] DirectX11 InputLayout failure..

    Thanks, that helps, I was following the tutorials on the SlimDX web site and got a little lost. I didn't know Effects existed for DX11 SlimDX. -Andrew
  5. I'm trying my first DX11 SlimDX render engine, and followed the example on the SlimDX site, but it failes at the InputLayout and says, invalid argument passed to return function: E_INVALIDARG: An invalid parameter was passed to the returning function (-2147024809) Any help is appreciated! I've included the verticie creation portion -Andrew this.vertices = new DataStream(12 * 3, true, true); vertices.Write(new Vector3(0.0f, 0.5f, 0.5f)); vertices.Write(new Vector3(0.5f, -0.5f, 0.5f)); vertices.Write(new Vector3(-0.5f, -0.5f, 0.5f)); vertices.Position = 0; this.vertexBuffer = new SlimDX.Direct3D11.Buffer(this.device, vertices, 12 * 3, ResourceUsage.Default, BindFlags.VertexBuffer, CpuAccessFlags.None, ResourceOptionFlags.None, 0); this.elements = new InputElement[] { new InputElement("POSITION", 0, SlimDX.DXGI.Format.R32G32B32_Float, 0) }; this.inputSignature = new SlimDX.D3DCompiler.ShaderSignature(this.vertices); this.inputSignature.Data.Position = 0; this.layout = new InputLayout(this.device, this.inputSignature, this.elements); And here's the shader code float4 VShader(float4 position : POSITION) : SV_POSITION { return position; } float4 PShader(float4 position : SV_POSITION) : SV_Target { return float4(1.0f, 1.0f, 0.0f, 1.0f); }
  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!