Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <ol> <li><p>You can ignore Visual Studio's Code Analysis, if you 100% sure that it will not be a problem in your case. However, it might be not very safety and personally I do not recomend to do so.</p></li> <li><p>Use helper interfaces/classes/delegates to avoid constructor virtual method call:</p> <pre><code>public interface IInputLayoutMaker { InputLayout MakeInputLayout(Device device, SlimDX.D3DCompiler.ShaderSignature inputSignature); } public abstract class ShaderBase { protected ShaderBase(Device device, string vertexShaderString, string pixelShaderString, IInputLayoutMaker inputLayoutMaker) { ShaderSignature inputSignature; using (ShaderBytecode bytecode = ShaderBytecode.CompileFromFile(vertexShaderString, "VShader", "vs_4_0", ShaderFlags.None, EffectFlags.None)) { vertexShader = new VertexShader(device, bytecode); inputSignature = ShaderSignature.GetInputSignature(bytecode); } inputLayout = inputLayoutMaker.MakeInputLayout(device,inputSignature); } protected abstract InputLayout MakeInputLayout(Device device, ShaderSignature inputSignature); } public class TextureShader:ShaderBase { private class TextureShaderInputLayoutMaker : IInputLayoutMaker { public InputLayout MakeInputLayout(Device device, SlimDX.D3DCompiler.ShaderSignature inputSignature) { return new InputLayout(device, inputSignature, new[] { new InputElement("POSITION", 0, SlimDX.DXGI.Format.R32G32B32_Float, 0), new InputElement("COLOR",0,SlimDX.DXGI.Format.R32G32B32_Float,0) }); } } public ColourShader(Device device) : base(device,"shaders/colour.fx", "shaders/colour.fx", new TextureShaderInputLayoutMaker()) { } } </code></pre></li> </ol>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload