<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VVVV.Hosting.Pins.Input;
using VVVV.PluginInterfaces.V2;
using VVVV.PluginInterfaces.V1;
using SlimDX.Direct3D11;

using VVVV.Hosting.Pins;
using VVVV.DX11.Lib;
using VVVV.DX11.Lib.Effects.Pins;

using FeralTic.DX11;
using FeralTic.DX11.Resources;
using SlimDX;
using FeralTic;

namespace VVVV.DX11.Internals.Effects.Pins
{
    public class Texture2DShaderPin : AbstractShaderV2Pin<DX11Resource<DX11Texture2D>>
    {
        protected override void ProcessAttribute(InputAttribute attr, EffectVariable var)
        {
            //Do nothing
        }

        protected override bool RecreatePin(EffectVariable variable)
        {
            return false;
        }

        private DX11Texture2D GetResource(DX11RenderContext context, int slice)
        {
            if (this.pin[slice] != null && this.pin[slice].Contains(context))
            {
                return this.pin[slice][context];
            }
            else
            {
                return context.DefaultTextures.WhiteTexture;
            }
        }

        public override Action<int> CreateAction(DX11ShaderInstance instance)
        {
            var sv = instance.Effect.GetVariableByName(this.Name).AsResource();<commit_msg>Fix null error on texture 2d pin<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VVVV.Hosting.Pins.Input;
using VVVV.PluginInterfaces.V2;
using VVVV.PluginInterfaces.V1;
using SlimDX.Direct3D11;

using VVVV.Hosting.Pins;
using VVVV.DX11.Lib;
using VVVV.DX11.Lib.Effects.Pins;

using FeralTic.DX11;
using FeralTic.DX11.Resources;
using SlimDX;
using FeralTic;

namespace VVVV.DX11.Internals.Effects.Pins
{
    public class Texture2DShaderPin : AbstractShaderV2Pin<DX11Resource<DX11Texture2D>>
    {
        protected override void ProcessAttribute(InputAttribute attr, EffectVariable var)
        {
            //Do nothing
        }

        protected override bool RecreatePin(EffectVariable variable)
        {
            return false;
        }

        private DX11Texture2D GetResource(DX11RenderContext context, int slice)
        {
            if (this.pin[slice] != null && this.pin[slice].Contains(context))
            {
                var tex = this.pin[slice][context];
                return tex != null ? tex : context.DefaultTextures.BlackTexture;
            }
            else
            {
                return context.DefaultTextures.WhiteTexture;
            }
        }

        public override Action<int> CreateAction(DX11ShaderInstance instance)
        {
            var sv = instance.Effect.GetVariableByName(this.Name).AsResource();
{'fraction_non_alphanumeric': 0.08543263964950712, 'fraction_numerical': 0.02154070828769624, 'mean_word_length': 2.5173299101412066, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3108236', 'n_tokens_mistral': 872, 'n_tokens_neox': 803, 'n_words': 161}