Esempio n. 1
0
        private unsafe EffectObjectIds ComputeInternal(ShaderMixinSource mixin, ShaderMixinParameters mixinParameters)
        {
            // Write to memory stream
            memStream.Position = 0;
            writer.Write(mixin);

            parameters.Clear();
            parameters.Set(CompilerParameters.GraphicsPlatformKey, mixinParameters.Get(CompilerParameters.GraphicsPlatformKey));
            parameters.Set(CompilerParameters.GraphicsProfileKey, mixinParameters.Get(CompilerParameters.GraphicsProfileKey));
            parameters.Set(CompilerParameters.DebugKey, mixinParameters.Get(CompilerParameters.DebugKey));
            writer.Write(parameters);

            // Compute hash
            objectIdBuilder.Reset();
            objectIdBuilder.Write((byte *)buffer, (int)memStream.Position);

            EffectObjectIds ids;

            ids.CompileParametersId = objectIdBuilder.ComputeHash();

            memStream.Position = 0;
            writer.Write(mixin);
            writer.Write(mixinParameters);
            objectIdBuilder.Reset();
            objectIdBuilder.Write((byte *)buffer, (int)memStream.Position);
            ids.FullParametersId = objectIdBuilder.ComputeHash();

            return(ids);
        }
Esempio n. 2
0
        /// <summary>
        /// Generates a Guid unique to this name
        /// </summary>
        /// <param name="name">the name to turn into a Guid</param>
        /// <returns>A unique Guid for the given name</returns>
        public static Guid DeviceNameToGuid(string name)
        {
            MemoryStream stream = new MemoryStream();
            DigestStream writer = new DigestStream(stream);

            {
                BinarySerializationWriter serializer = new HashSerializationWriter(writer);
                serializer.Write(typeof(IInputDevice).GetHashCode());
                serializer.Write(name);
            }

            return(writer.CurrentHash.ToGuid());
        }
Esempio n. 3
0
        private unsafe ObjectId ComputeInternal(ShaderMixinSource mixin, ShaderMixinParameters mixinParameters)
        {
            // Write to memory stream
            memStream.Position = 0;
            writer.Write(EffectBytecode.MagicHeader); // Write the effect bytecode magic header
            writer.Write(mixin);

            parameters.Clear();
            parameters.Set(CompilerParameters.GraphicsPlatformKey, mixinParameters.Get(CompilerParameters.GraphicsPlatformKey));
            parameters.Set(CompilerParameters.GraphicsProfileKey, mixinParameters.Get(CompilerParameters.GraphicsProfileKey));
            parameters.Set(CompilerParameters.DebugKey, mixinParameters.Get(CompilerParameters.DebugKey));
            writer.Write(parameters);

            // Compute hash
            objectIdBuilder.Reset();
            objectIdBuilder.Write((byte *)buffer, (int)memStream.Position);

            return(objectIdBuilder.ComputeHash());
        }
Esempio n. 4
0
        private unsafe ObjectId ComputeInternal(ShaderMixinSource mixin, EffectCompilerParameters effectCompilerParameters)
        {
            // Write to memory stream
            memStream.Position = 0;
            writer.Write(EffectBytecode.MagicHeader); // Write the effect bytecode magic header
            writer.Write(mixin);

            writer.Write(effectCompilerParameters.Platform);
            writer.Write(effectCompilerParameters.Profile);
            writer.Write(effectCompilerParameters.Debug);
            writer.Write(effectCompilerParameters.OptimizationLevel);

            // Compute hash
            objectIdBuilder.Reset();
            objectIdBuilder.Write((byte *)buffer, (int)memStream.Position);

            return(objectIdBuilder.ComputeHash());
        }