コード例 #1
0
        protected override void LoadFromMicrocode(D3D9.Device d3D9Device, D3D9.ShaderBytecode microcode)
        {
            D3D9.PixelShader pixelShader;
            var shaderWasFound = this._mapDeviceToPixelShader.TryGetValue(d3D9Device, out pixelShader);

            if (shaderWasFound)
            {
                pixelShader.SafeDispose();
            }

            if (IsSupported)
            {
                // Create the shader
                pixelShader = new D3D9.PixelShader(d3D9Device, microcode);
            }
            else
            {
                LogManager.Instance.Write("Unsupported D3D9 pixel shader '{0}' was not loaded.", _name);
                pixelShader = null;
            }

            if (shaderWasFound)
            {
                this._mapDeviceToPixelShader[d3D9Device] = pixelShader;
            }
            else
            {
                this._mapDeviceToPixelShader.Add(d3D9Device, pixelShader);
            }
        }
コード例 #2
0
ファイル: CPixelShader.cs プロジェクト: Zulkir/Beholder
        public CPixelShader(ICDevice device, CShaderReflection reflection)
            : base(device, reflection)
        {
            profile = ParseProfile(reflection.Profile);

            var text = GenerateText();
            try
            {
                var bytecode = ShaderBytecode.Compile(text, "main", ProfileToString(profile), ShaderFlags.PackMatrixColumnMajor | ShaderFlags.OptimizationLevel3);
                d3dShader = new PixelShader(device.D3DDevice, bytecode);
                bytecode.Dispose();
            }
            catch (Exception e)
            {
                throw new ArgumentException(string.Format("Failed to compile a pixel shader '{0}'\r\n--- Code ---\r\n{1}\r\n--- Errors ---\r\n{2}", Name, text, e.Message), e);
            }
        }
コード例 #3
0
ファイル: D3D9GpuProgram.cs プロジェクト: ryan-bunker/axiom3d
		protected override void LoadFromMicrocode( D3D9.Device d3D9Device, D3D9.ShaderBytecode microcode )
		{
			D3D9.PixelShader pixelShader;
			var shaderWasFound = this._mapDeviceToPixelShader.TryGetValue( d3D9Device, out pixelShader );
			if ( shaderWasFound )
			{
				pixelShader.SafeDispose();
			}

			if ( IsSupported )
			{
				// Create the shader
				pixelShader = new D3D9.PixelShader( d3D9Device, microcode );
			}
			else
			{
				LogManager.Instance.Write( "Unsupported D3D9 pixel shader '{0}' was not loaded.", _name );
				pixelShader = null;
			}

			if ( shaderWasFound )
			{
				this._mapDeviceToPixelShader[ d3D9Device ] = pixelShader;
			}
			else
			{
				this._mapDeviceToPixelShader.Add( d3D9Device, pixelShader );
			}
		}