Example #1
0
        public LeaEffect(GraphicsDevice device, EffectCreateInfo createInfo, string vsDebugName = "", string psDebugName = "", string gsDebugName = "")
        {
            graphicsDevice = device;

            if (!string.IsNullOrEmpty(createInfo.VertexShaderPath) || !string.IsNullOrEmpty(createInfo.VertexShaderBlob))
            {
                var vertexShader = new EVertexShader(graphicsDevice, createInfo, vsDebugName);
                shaders.Add(vertexShader);
            }

            if (!string.IsNullOrEmpty(createInfo.PixelShaderPath) || !string.IsNullOrEmpty(createInfo.PixelShaderBlob))
            {
                var pixelShader = new EPixelShader(graphicsDevice, createInfo, psDebugName);
                shaders.Add(pixelShader);
            }

            if (!string.IsNullOrEmpty(createInfo.GeometryShaderPath) || !string.IsNullOrEmpty(createInfo.GeometryShaderBlob))
            {
                var geometryShader = new EGeometryShader(graphicsDevice, createInfo, gsDebugName);
                shaders.Add(geometryShader);
            }

            if (!string.IsNullOrEmpty(createInfo.ComputeShaderPath))
            {
                Console.WriteLine();
            }
        }
        public EVertexShader(GraphicsDevice graphicsDevice, EffectCreateInfo createInfo, string debugName = "")
        {
            base.graphicsDevice = graphicsDevice;

            shaderType = ShaderType.VertexShader;

#if DEBUG
            base.debugName = debugName;
#endif

            // if Blob is 0, try to use File instead
            if (string.IsNullOrEmpty(createInfo.VertexShaderBlob))
            {
                shaderByteCode = GetShaderByteCode(createInfo.VertexShaderPath, createInfo.VertexShaderEntryPoint, "vs_5_0");
            }
            else
            {
                shaderByteCode = GetShaderByteCodeFromResource(createInfo.VertexShaderBlob, createInfo.VertexShaderEntryPoint, "vs_5_0");
            }

            shaderReflection = ReflectShaderByteCode();


            vertexShader = new VertexShader(graphicsDevice.NatiDevice1.D3D11Device, shaderByteCode);

            constantBuffers = ReflectConstantBuffers();

            GenerateInputLayout();
        }
        public EGeometryShader(GraphicsDevice graphicsDevice, EffectCreateInfo createInfo, string debugName = "")
        {
            base.graphicsDevice = graphicsDevice;

            shaderType = ShaderType.GeometryShader;

            if (string.IsNullOrEmpty(createInfo.GeometryShaderBlob))
            {
                shaderByteCode = GetShaderByteCode(createInfo.GeometryShaderPath, createInfo.GeometryShaderEntryPoint, "gs_5_0");
            }
            else
            {
                shaderByteCode = GetShaderByteCodeFromResource(createInfo.GeometryShaderBlob, createInfo.GeometryShaderEntryPoint, "gs_5_0");
            }


            shaderReflection = ReflectShaderByteCode();

#if DEBUG
            base.debugName = debugName;
#endif
            constantBuffers = ReflectConstantBuffers();

            GeometryShader = new GeometryShader(graphicsDevice.NatiDevice1.D3D11Device, shaderByteCode);
        }