Beispiel #1
0
        private bool CheckIfTextureSetIsValid(string name, Texture texture, int textureUnit)
        {
            ActiveUniformType uniformType = ShaderTypeConversions.GetUniformType(texture.TextureTarget);
            bool validUniform             = errorLog.IsValidUniform(activeUniformByName, name, uniformType);

            if (!validUniform)
            {
                LogInvalidUniformSetRaiseEvent(name, texture, uniformType);
            }

            bool validSamplerType = errorLog.IsValidSamplerType(textureUnit, uniformType);

            if (!validSamplerType)
            {
                var textureSetArgs = new TextureSetEventArgs()
                {
                    Name        = name,
                    Type        = uniformType,
                    TextureUnit = textureUnit,
                    Value       = texture
                };

                OnTextureUnitTypeMismatch?.Invoke(this, textureSetArgs);
            }

            bool validSet = validUniform && validSamplerType;

            return(validSet);
        }
Beispiel #2
0
 private void Shader_OnTextureUnitTypeMismatch(object sender, TextureSetEventArgs e)
 {
     invalidTextureSets.Add(e);
 }