Ejemplo n.º 1
0
            public void SetSamplers(PixelShaderType shaderType, int slot, SamplerState[] samplers)
            {
                if (slot < 0)
                {
                    return;
                }
                int  idx        = SamplerCheckPixelShaderStartIdx + slot;
                bool needUpdate = false;

                for (int i = 0; i < samplers.Length; ++i)
                {
                    if (SamplerStateCheck[idx + i] != samplers[i])
                    {
                        needUpdate = true;
                        break;
                    }
                }
                if (needUpdate)
                {
                    for (int i = 0; i < samplers.Length; ++i)
                    {
                        SamplerStateCheck[idx + i] = samplers[i];
                    }
                    deviceContext.PixelShader.SetSamplers(slot, samplers);
                }
            }
Ejemplo n.º 2
0
 public void SetShaderResources(PixelShaderType shaderType, int slot, ShaderResourceView[] texture)
 {
     if (slot < 0)
     {
         return;
     }
     deviceContext.PixelShader.SetShaderResources(slot, texture);
 }
Ejemplo n.º 3
0
 public void SetSamplers(PixelShaderType shaderType, int slot, SamplerState[] samplers)
 {
     if (slot < 0)
     {
         return;
     }
     deviceContext.PixelShader.SetSamplers(slot, samplers);
 }
Ejemplo n.º 4
0
            public void SetSampler(PixelShaderType shaderType, int slot, SamplerState sampler)
            {
                if (slot < 0)
                {
                    return;
                }
                int idx = SamplerCheckPixelShaderStartIdx + slot;

                if (SamplerStateCheck[idx] != sampler)
                {
                    SamplerStateCheck[idx] = sampler;
                    deviceContext.PixelShader.SetSampler(slot, sampler);
                }
            }
 /// <summary>
 /// Adds a new material renderer to the VideoDriver, based on a high level shading language. Currently only HLSL/D3D9 and GLSL/OpenGL is supported. 
 /// </summary>
 /// <param name="vsprogram">String containing the source of the vertex shader program. This can be "" if no vertex program should be used. </param>
 /// <param name="ventrypoint">Name of the function of the vertexShaderProgram </param>
 /// <param name="vsCompileTarget">Vertex shader version where the high level shader should be compiled to. </param>
 /// <param name="psprogram">String containing the source of the pixel shader program. This can be "" if no pixel shader should be used.</param>
 /// <param name="psEntryPoint">Entry name of the function of the pixelShaderEntryPointName </param>
 /// <param name="psCompileTarget">Pixel shader version where the high level shader should be compiled to. </param>
 /// <param name="callback">Delegate in which you can set the needed vertex and pixel shader program constants.</param>
 /// <param name="baseMat">Base material which renderstates will be used to shade the material. </param>
 /// <param name="userData">An user data int. This int can be set to any value and will be set as parameter in the callback method when calling OnSetConstants(). In this way it is easily possible to use the same delegate method for multiple materials and distinguish between them during the call.</param>
 /// <returns>The Material to use with SetMaterial (with a C-style explicit cast). -1 if failed</returns>
 public int AddHighLevelShaderMaterial(string vsprogram, string ventrypoint, VertexShaderType vsCompileTarget, string psprogram, string psEntryPoint, PixelShaderType psCompileTarget, OnShaderConstantSetDelegate callback, MaterialType baseMat, int userData)
 {
     //WORKAROUND : Bug found by DeusXL, little workaround I don't like at all but needed !
     string vsfilename = System.IO.Path.GetTempFileName();
     StreamWriter vssw = new StreamWriter(vsfilename, false);
     string psfilename = System.IO.Path.GetTempFileName();
     StreamWriter pssw = new StreamWriter(psfilename, false);
     vssw.WriteLine(vsprogram);
     pssw.WriteLine(psprogram);
     vssw.Close();
     pssw.Close();
     int ret = AddHighLevelShaderMaterialFromFiles(vsfilename, ventrypoint, vsCompileTarget, psfilename, psEntryPoint, psCompileTarget, callback, baseMat, userData);
     try { File.Delete(vsfilename); File.Delete(psfilename); }
     catch (Exception) { }
     return ret;
 }
Ejemplo n.º 6
0
 public PixelShader GetShader(PixelShaderType type)
 {
     return(PixelShader);
 }
 /// <summary>
 /// Adds a new material renderer to the VideoDriver, based on a high level shading language. Currently only HLSL/D3D9 and GLSL/OpenGL is supported. 
 /// </summary>
 /// <param name="program">String containing the path to the vertex shader program. This can be "" (empty string) if no vertex program should be used. </param>
 /// <param name="ventrypoint">Name of the function of the vertexShaderProgram </param>
 /// <param name="vsCompileTarget">Vertex shader version where the high level shader should be compiled to. </param>
 /// <param name="pixelShaderProgram">String containing the path to the pixel shader program. This can be "" (empty string) if no pixel shader should be used.</param>
 /// <param name="psEntryPoint">Entry name of the function of the pixelShaderEntryPointName </param>
 /// <param name="psCompileTarget">Pixel shader version where the high level shader should be compiled to. </param>
 /// <param name="callback">Delegate in which you can set the needed vertex and pixel shader program constants.</param>
 /// <param name="baseMat">Base material which renderstates will be used to shade the material. </param>
 /// <param name="userData">An user data int. This int can be set to any value and will be set as parameter in the callback method when calling OnSetConstants(). In this way it is easily possible to use the same delegate method for multiple materials and distinguish between them during the call.</param>
 /// <returns>The Material to use with SetMaterial (with a C-style explicit cast). -1 if failed</returns>
 public int AddHighLevelShaderMaterialFromFiles(string program, string ventrypoint, VertexShaderType vsCompileTarget, string pixelShaderProgram, string psEntryPoint, PixelShaderType psCompileTarget, OnShaderConstantSetDelegate callback, MaterialType baseMat, int userData)
 {
     return GPU_AddHighLevelShaderMaterialFromFiles(_raw, program, ventrypoint, vsCompileTarget, pixelShaderProgram, psEntryPoint, psCompileTarget, new ShaderConstantCallback(callback).OnNativeShaderConstant, baseMat, userData);
 }
 static extern int GPU_AddHighLevelShaderMaterialFromFiles(IntPtr gpu, string file, string ventrypoint, VertexShaderType vsCompileTarget, string psfile, string psEntryPoint, PixelShaderType psCompileTarget, OnNativeSCSD callback, MaterialType baseMat, int userData);
Ejemplo n.º 9
0
 public SamplerState[] GetSampler(PixelShaderType shaderType, int startSlot, int num)
 {
     return(deviceContext.PixelShader.GetSamplers(startSlot, num));
 }
Ejemplo n.º 10
0
 public ShaderResourceView[] GetShaderResources(PixelShaderType shaderType, int startSlot, int num)
 {
     return(deviceContext.PixelShader.GetShaderResources(startSlot, num));
 }