private async void GpuViewHost_ChildChanged(object sender, EventArgs e)
        {
            WindowsXamlHost windowsXamlHost = (WindowsXamlHost)sender;
            SwapChainPanel  swapChainPanel  = (SwapChainPanel)windowsXamlHost.Child;

            GpuView = swapChainPanel;
            Gpu     = new Gpu();
#if DEBUG
            Gpu.EnableD3D12DebugLayer();
#endif
            GpuView.Width  = this.Width;
            GpuView.Height = this.Height;
            await Init();

            SizeChanged += MainWindow_SizeChanged;
            GpuFence fence             = Device.DefaultQueue.CreateFence();
            UInt64   currentFenceValue = 0;
            while (true)
            {
                if (SwapChain == null)
                {
                    SwapChainDescriptor = new GpuSwapChainDescriptor(GpuTextureFormat.BGRA8UNorm, (uint)GpuView.Width, (uint)GpuView.Height);
                    SwapChain           = Device.ConfigureSwapChainForSwapChainPanel(SwapChainDescriptor, GpuView);
                    DepthTexture        = Device.CreateTexture(new GpuTextureDescriptor(new GpuExtend3DDict {
                        Width = SwapChainDescriptor.Width, Height = SwapChainDescriptor.Height, Depth = 1
                    }, GpuTextureFormat.Depth24PlusStencil8, GpuTextureUsageFlags.OutputAttachment));
                }
                DrawFrame();
                var fenceValueWaitFor = ++currentFenceValue;
                Device.DefaultQueue.Signal(fence, fenceValueWaitFor);
                await fence.OnCompletionAsync(fenceValueWaitFor);
            }
        }
Esempio n. 2
0
        bool CreateTexture()
        {
            Vector2I textureSize = new Vector2I(Round2(size.X), Round2(size.Y));

            texture               = ComponentUtility.CreateComponent <Component_Image>(null, true, false);
            texture.CreateType    = Component_Image.TypeEnum._2D;
            texture.CreateSize    = textureSize;
            texture.CreateMipmaps = false;            // 0;
            //!!!!
            texture.CreateFormat = PixelFormat.A8R8G8B8;
            texture.CreateUsage  = Component_Image.Usages.Dynamic | Component_Image.Usages.WriteOnly;
            texture.Enabled      = true;

            //if( !c.Create( Component_Texture.TypeEnum.Type2D, textureSize, 1, 0, PixelFormat.A8R8G8B8, GpuTexture.Usages.DynamicWriteOnly ) )
            //{
            //	texture.Dispose();
            //	return false;
            //}

            GpuTexture gpuTexture = texture.Result;

            int totalSize = PixelFormatUtility.GetNumElemBytes(gpuTexture.ResultFormat) * gpuTexture.ResultSize.X * gpuTexture.ResultSize.Y;

            byte[] data = new byte[totalSize];
            var    d    = new GpuTexture.SurfaceData[] { new GpuTexture.SurfaceData(0, 0, data) };

            gpuTexture.SetData(d);

            textureFormat = texture.CreateFormat;

            //HardwarePixelBuffer pixelBuffer = texture.GetBuffer();
            //pixelBuffer.Lock( HardwareBuffer.LockOptions.Discard );
            //PixelBox pixelBox = pixelBuffer.GetCurrentLock();
            //textureFormat = pixelBox.Format;
            //NativeUtils.ZeroMemory( pixelBox.Data, pixelBox.SlicePitch * 4 );
            //pixelBuffer.Unlock();

            if (textureFormat != PixelFormat.A8R8G8B8 && textureFormat != PixelFormat.A8B8G8R8)
            {
                Log.Warning("UIVideo: CreateTexture: Lock texture format != PixelFormat.A8R8G8B8 and != PixelFormat.A8B8G8R8 ({0}).", textureFormat);
            }

            RenderingSystem.RenderSystemEvent += RenderSystem_RenderSystemEvent;

            return(true);
        }
Esempio n. 3
0
        protected override void OnSetShaderParameters(ViewportRenderingContext context, Component_RenderingPipeline.IFrameData frameData, Component_Image actualTexture, CanvasRenderer.ShaderItem shader)
        {
            base.OnSetShaderParameters(context, frameData, actualTexture, shader);

            var noiseTexture = ResourceManager.LoadResource <Component_Image>(noiseTextureDefault);

            if (noiseTexture == null)
            {
                return;
            }

            GpuTexture gpuNoiseTexture = noiseTexture.Result;            // ResourceUtility.GetTextureCompiledData( noiseTexture );

            shader.Parameters.Set(new ViewportRenderingContext.BindTextureData(1 /*"noiseTexture"*/,
                                                                               noiseTexture, TextureAddressingMode.Wrap, FilterOption.Point, FilterOption.Point, FilterOption.Point));
            //shader.Parameters.Set( "1"/*"noiseTexture"*/, new GpuMaterialPass.TextureParameterValue( noiseTexture,
            //	TextureAddressingMode.Wrap, FilterOption.Point, FilterOption.Point, FilterOption.Point ) );

            {
                var size = actualTexture.Result.ResultSize;
                shader.Parameters.Set("viewportSize", new Vector4(size.X, size.Y, 1.0 / (double)size.X, 1.0 / (double)size.Y).ToVector4F());
            }

            {
                var size = gpuNoiseTexture.ResultSize;
                shader.Parameters.Set("noiseTextureSize", new Vector4(size.X, size.Y, 1.0 / (double)size.X, 1.0 / (double)size.Y).ToVector4F());
            }

            bool r = SeedRandom;

            Vector4F seeds = Vector4F.Zero;

            if (r)
            {
                seeds = new Vector4F(random.NextFloat(), random.NextFloat(), random.NextFloat(), random.NextFloat());
            }
            shader.Parameters.Set("seeds", seeds);
        }
        public static ParameterType DetectTypeByValue(object value)
        {
            if (value is string)
            {
                return(ParameterType.String);
            }

            GpuTexture texture = value as GpuTexture;

            if (texture != null)
            {
                switch (texture.TextureType)
                {
                //case Component_Texture.TypeEnum._1D: return ParameterType.Texture1D;
                case Component_Image.TypeEnum._2D: return(ParameterType.Texture2D);

                case Component_Image.TypeEnum._3D: return(ParameterType.Texture3D);

                case Component_Image.TypeEnum.Cube: return(ParameterType.TextureCube);
                }
            }

            return(DetectTypeByClassType(value.GetType()));
        }
        public Component_Image GetImage(out long uniqueMaskDataCounter)
        {
            uniqueMaskDataCounter = 0;

            if (MaskImage.Value != null)
            {
                return(MaskImage);
            }
            else if (Mask.Value != null && Mask.Value.Length != 0)
            {
                if (EnabledInHierarchy)
                {
                    if (createdMaskImage == null)
                    {
                        int textureSize = (int)Math.Sqrt(Mask.Value.Length);

                        //need set ShowInEditor = false before AddComponent
                        var texture = ComponentUtility.CreateComponent <Component_Image>(null, false, false);
                        texture.DisplayInEditor = false;
                        AddComponent(texture, -1);
                        //var texture = CreateComponent<Component_Image>( enabled: false );

                        texture.SaveSupport  = false;
                        texture.CloneSupport = false;

                        //!!!!
                        bool mipmaps = false;

                        texture.CreateType    = Component_Image.TypeEnum._2D;
                        texture.CreateSize    = new Vector2I(textureSize, textureSize);
                        texture.CreateMipmaps = mipmaps;
                        texture.CreateFormat  = PixelFormat.L8;

                        var usage = Component_Image.Usages.WriteOnly;
                        if (mipmaps)
                        {
                            usage |= Component_Image.Usages.AutoMipmaps;
                        }
                        texture.CreateUsage = usage;

                        texture.Enabled = true;

                        createdMaskImage           = texture;
                        createdMaskImageNeedUpdate = true;
                    }

                    //update data
                    if (createdMaskImageNeedUpdate)
                    {
                        GpuTexture gpuTexture = createdMaskImage.Result;
                        if (gpuTexture != null)
                        {
                            var d = new GpuTexture.SurfaceData[] { new GpuTexture.SurfaceData(0, 0, Mask.Value) };
                            gpuTexture.SetData(d);
                        }

                        createdMaskImageNeedUpdate = false;
                    }

                    uniqueMaskDataCounter = this.uniqueMaskDataCounter;
                    return(createdMaskImage);
                }
            }
            return(null);
        }
Esempio n. 6
0
        ////Tick

        //public void PerformUITick( double delta )
        //{
        //	CheckCachedParameters();
        //	UpdateTopMouseCoversControl();

        //	if( capturedControl != null && capturedControl.ParentContainer == null )
        //		capturedControl = null;
        //	if( focusedControl != null && focusedControl.ParentContainer == null )
        //		focusedControl = null;

        //	OnUITick( delta );

        //	//!!!!где еще вызывать это? и для каких типов объектов
        //}

        //Render

        //public void DoRender()
        //{
        //CheckCachedParameters();
        //UpdateTopMouseCoversControl();

        //CurrentCursor = defaultCursor;

        //было, не нужно
        //OnRenderWithChildren();
        //}

        void DrawCursor(CanvasRenderer renderer)
        {
            lastCursorRectangle = Rectangle.Zero;

            //hide cursor for mouse relative mode
            if (MouseRelativeMode)
            {
                currentCursor = null;
            }

            //!!!!!!focused иначе проверять
            //!!!!!!EngineApp.Instance.ApplicationWindow.Focused?
            if (!string.IsNullOrEmpty(currentCursor))               //!!!!!EngineApp.Instance.ApplicationWindow.Focused/*IsWindowFocused()*/ && EngineApp.Instance.IsCreated && !LongOperationCallbackManager.DuringCallingCallback )
            {
                //!!!!Wait
                var        textureIns = ResourceManager.LoadResource <Component_Image>(currentCursor);
                GpuTexture texture    = textureIns?.Result;
                if (texture != null)
                {
                    //!!!!было
                    //texture._ThisIsGuiTexture = true;

                    if (drawCursorWithPerPixelAccuracy)
                    {
                        Vector2 screenPixelSize = viewport.SizeInPixels.ToVector2();

                        Vector2 m           = MousePosition * screenPixelSize;
                        Vector2 leftTop     = m - texture.SourceSize.ToVector2F() * .5f;
                        Vector2 rightBottom = m + texture.SourceSize.ToVector2F() * .5f;

                        //!!!!!
                        //per pixel alignment
                        //if( this is UIContainerScreen )
                        {
                            leftTop = new Vector2((int)(leftTop.X + .9999f), (int)(leftTop.Y + .9999f));

                            //!!!!
                            //if( RenderSystem.Instance.IsDirect3D() )
                            //	leftTop -= new Vec2( .5f, .5f );

                            rightBottom = new Vector2((int)(rightBottom.X + .9999f), (int)(rightBottom.Y + .9999f));
                            //!!!!
                            //if( RenderSystem.Instance.IsDirect3D() )
                            //	rightBottom -= new Vec2( .5f, .5f );
                        }

                        leftTop     /= screenPixelSize;
                        rightBottom /= screenPixelSize;

                        Rectangle rectangle = new Rectangle(leftTop, rightBottom);
                        renderer.AddQuad(rectangle, new Rectangle(0, 0, 1, 1), textureIns, new ColorValue(1, 1, 1), true);

                        lastCursorRectangle = rectangle;
                    }
                    else
                    {
                        double  baseHeight = UIControlsWorld.ScaleByResolutionBaseHeight;
                        Vector2 size       = texture.SourceSize.ToVector2F() / new Vector2(baseHeight * renderer.AspectRatio, baseHeight);

                        Rectangle rectangle = new Rectangle(-size / 2, size / 2) + MousePosition;

                        renderer.AddQuad(rectangle, new Rectangle(0, 0, 1, 1), textureIns, new ColorValue(1, 1, 1), true);

                        lastCursorRectangle = rectangle;
                    }
                }
            }
        }
Esempio n. 7
0
        public unsafe void UpdateTexture(bool clearWholeTexture)
        {
            if (size == Vector2I.Zero)
            {
                return;
            }
            if (RenderingSystem.IsDeviceLost())
            {
                return;
            }

            if (texture != null && texture.Disposed)
            {
                texture = null;
            }

            //create texture
            if (texture == null)
            {
                if (!CreateTexture())
                {
                    return;
                }
            }

            if (textureFormat != PixelFormat.A8R8G8B8 && textureFormat != PixelFormat.A8B8G8R8)
            {
                return;
            }

            GpuTexture gpuTexture = texture.Result;

            int totalSize = PixelFormatUtility.GetNumElemBytes(gpuTexture.ResultFormat) * gpuTexture.ResultSize.X * gpuTexture.ResultSize.Y;

            //!!!!можно каждый раз не создавать массив
            byte[] data = new byte[totalSize];

            //HardwarePixelBuffer pixelBuffer = texture.GetBuffer();
            //pixelBuffer.Lock( HardwareBuffer.LockOptions.Discard );
            //PixelBox pixelBox = pixelBuffer.GetCurrentLock();

            //if( clearWholeTexture )
            //	NativeUtility.ZeroMemory( data, pixelBox.SlicePitch * 4 );

            byte *pointer = (byte *)buffer;

            for (int y = 0; y < size.Y; y++)
            {
                //!!!!всегда так?
                int rowPitch = PixelFormatUtility.GetNumElemBytes(gpuTexture.ResultFormat) * gpuTexture.ResultSize.X;

                Marshal.Copy((IntPtr)pointer, data, y * rowPitch, size.X * 4);
                //NativeUtility.CopyMemory( pointer, source, length );
                //pixelBox.WriteDataUnmanaged( y * pixelBox.RowPitch * 4, pointer, size.X * 4 );

                pointer += size.X * 4;
            }

            //pixelBuffer.Unlock();

            var d = new GpuTexture.SurfaceData[] { new GpuTexture.SurfaceData(0, 0, data) };

            gpuTexture.SetData(d);

            needUpdateTexture = false;
        }
Esempio n. 8
0
        async Task Init()
        {
            var adapter = await Gpu.RequestAdapterAsync();

            Device = await adapter.RequestDeviceAsync();

            var rectVerts = new float[]
            {
                1.0f, 1.0f, 0.0f, 1.0f, 0.0f,
                1.0f, -1.0f, 0.0f, 1.0f, 1.0f,
                -1.0f, -1.0f, 0.0f, 0.0f, 1.0f,
                1.0f, 1.0f, 0.0f, 1.0f, 0.0f,
                -1.0f, -1.0f, 0.0f, 0.0f, 1.0f,
                -1.0f, 1.0f, 0.0f, 0.0f, 0.0f
            };

            VerticesBuffer = Device.CreateBuffer(new GpuBufferDescriptor((uint)Buffer.ByteLength(rectVerts), GpuBufferUsageFlags.Vertex)
            {
                MappedAtCreation = true
            });
            CreateBufferFromArray(rectVerts).CopyTo(VerticesBuffer.GetMappedRange());
            VerticesBuffer.Unmap();

            var blurBindGroupLayouts = new GpuBindGroupLayout[] {
                Device.CreateBindGroupLayout(new GpuBindGroupLayoutDescriptor(new GpuBindGroupLayoutEntry[]
                {
                    new GpuBindGroupLayoutEntry()
                    {
                        Binding    = 0,
                        Visibility = GpuShaderStageFlags.Compute,
                        Sampler    = new GpuSamplerBindingLayout()
                        {
                            Type = GpuSamplerBindingType.Filtering
                        }
                    },
                    new GpuBindGroupLayoutEntry()
                    {
                        Binding    = 1,
                        Visibility = GpuShaderStageFlags.Compute,
                        Buffer     = new GpuBufferBindingLayout()
                        {
                            Type             = GpuBufferBindingType.Uniform,
                            HasDynamicOffset = false,
                            MinBindingSize   = 2 * 4 /* 2 uints */
                        }
                    }
                })),
                Device.CreateBindGroupLayout(new GpuBindGroupLayoutDescriptor(new GpuBindGroupLayoutEntry[]
                {
                    new GpuBindGroupLayoutEntry()
                    {
                        Binding    = 1,
                        Visibility = GpuShaderStageFlags.Compute,
                        Texture    = new GpuTextureBindingLayout()
                        {
                            SampleType    = GpuTextureSampleType.Float,
                            ViewDimension = GpuTextureViewDimension._2D,
                            Multisampled  = false
                        }
                    },
                    new GpuBindGroupLayoutEntry()
                    {
                        Binding        = 2,
                        Visibility     = GpuShaderStageFlags.Compute,
                        StorageTexture = new GpuStorageTextureBindingLayout()
                        {
                            Format        = GpuTextureFormat.RGBA8UNorm,
                            Access        = GpuStorageTextureAccess.WriteOnly,
                            ViewDimension = GpuTextureViewDimension._2D
                        }
                    },
                    new GpuBindGroupLayoutEntry()
                    {
                        Binding    = 3,
                        Visibility = GpuShaderStageFlags.Compute,
                        Buffer     = new GpuBufferBindingLayout()
                        {
                            Type             = GpuBufferBindingType.Uniform,
                            HasDynamicOffset = false,
                            MinBindingSize   = 4
                        }
                    }
                }))
            };

            GpuShaderModule computeShader;

            using (var shaderFileStream = typeof(MainPage).Assembly.GetManifestResourceStream("ImageBlur.compute.hlsl"))
                using (var shaderStreamReader = new StreamReader(shaderFileStream))
                {
                    var shaderCode = await shaderStreamReader.ReadToEndAsync();

                    computeShader = Device.CreateShaderModule(new GpuShaderModuleDescriptor(GpuShaderSourceType.Hlsl, shaderCode));
                }
            GpuShaderModule drawShader;

            using (var shaderFileStream = typeof(MainPage).Assembly.GetManifestResourceStream("ImageBlur.draw.hlsl"))
                using (var shaderStreamReader = new StreamReader(shaderFileStream))
                {
                    var shaderCode = await shaderStreamReader.ReadToEndAsync();

                    drawShader = Device.CreateShaderModule(new GpuShaderModuleDescriptor(GpuShaderSourceType.Hlsl, shaderCode));
                }
            BlurPipeline = Device.CreateComputePipeline(new GpuComputePipelineDescriptor(new GpuProgrammableStage(computeShader, "main"))
            {
                Layout = Device.CreatePipelineLayout(new GpuPipelineLayoutDescriptor()
                {
                    BindGroupLayouts = blurBindGroupLayouts
                })
            });

            var bindGroupLayout = Device.CreateBindGroupLayout(new GpuBindGroupLayoutDescriptor(new GpuBindGroupLayoutEntry[]
            {
                new GpuBindGroupLayoutEntry()
                {
                    Binding    = 0,
                    Visibility = GpuShaderStageFlags.Fragment,
                    Sampler    = new GpuSamplerBindingLayout()
                    {
                        Type = GpuSamplerBindingType.Filtering,
                    }
                },
                new GpuBindGroupLayoutEntry()
                {
                    Binding    = 1,
                    Visibility = GpuShaderStageFlags.Fragment,
                    Texture    = new GpuTextureBindingLayout()
                    {
                        SampleType    = GpuTextureSampleType.Float,
                        ViewDimension = GpuTextureViewDimension._2D,
                        Multisampled  = false
                    }
                }
            }));


            Pipeline = Device.CreateRenderPipeline(new GpuRenderPipelineDescriptor(new GpuVertexState(drawShader, "VSMain")
            {
                VertexBuffers = new GpuVertexBufferLayout[]
                {
                    new GpuVertexBufferLayout(20, new GpuVertexAttribute[]
                    {
                        new GpuVertexAttribute()
                        {
                            Format         = GpuVertexFormat.Float3,
                            Offset         = 0,
                            ShaderLocation = 0
                        },
                        new GpuVertexAttribute()
                        {
                            Format         = GpuVertexFormat.Float2,
                            Offset         = 12,
                            ShaderLocation = 1
                        }
                    })
                }
            })
            {
                Layout = Device.CreatePipelineLayout(new GpuPipelineLayoutDescriptor()
                {
                    BindGroupLayouts = new GpuBindGroupLayout[] { bindGroupLayout }
                }),
                Fragment = new GpuFragmentState(drawShader, "PSMain", new GpuColorTargetState[] { new GpuColorTargetState()
                                                                                                  {
                                                                                                      Format = SwapChainFormat, Blend = null, WriteMask = GpuColorWriteFlags.All
                                                                                                  } }),
                Primitive = new GpuPrimitiveState()
                {
                    Topology  = GpuPrimitiveTopology.TriangleList,
                    CullMode  = GpuCullMode.None,
                    FrontFace = GpuFrontFace.Ccw
                }
            });
            var sampler = Device.CreateSampler(new GpuSamplerDescriptor()
            {
                MinFilter = GpuFilterMode.Linear,
                MagFilter = GpuFilterMode.Linear
            });

            var imgDecoder = await BitmapDecoder.CreateAsync(typeof(MainPage).Assembly.GetManifestResourceStream("ImageBlur.Di_3d.png").AsRandomAccessStream());

            var imageBitmap = await imgDecoder.GetSoftwareBitmapAsync();

            (SrcWidth, SrcHeight) = ((uint)imageBitmap.PixelWidth, (uint)imageBitmap.PixelHeight);
            var cubeTexture = Device.CreateTexture(new GpuTextureDescriptor(new GpuExtend3DDict {
                Width = (uint)imageBitmap.PixelWidth, Height = (uint)imageBitmap.PixelHeight, Depth = 1
            }, GpuTextureFormat.BGRA8UNorm, GpuTextureUsageFlags.Sampled | GpuTextureUsageFlags.CopyDst));

            Device.DefaultQueue.CopyImageBitmapToTexture(new GpuImageCopyImageBitmap(imageBitmap), new GpuImageCopyTexture(cubeTexture), new GpuExtend3DDict {
                Width = (uint)imageBitmap.PixelWidth, Height = (uint)imageBitmap.PixelHeight, Depth = 1
            });
            var textures = new GpuTexture[2]
            {
                Device.CreateTexture(new GpuTextureDescriptor(new GpuExtend3DDict {
                    Width = SrcWidth, Height = SrcHeight, Depth = 1
                }, GpuTextureFormat.RGBA8UNorm, GpuTextureUsageFlags.CopyDst | GpuTextureUsageFlags.Storage | GpuTextureUsageFlags.Sampled)),
                Device.CreateTexture(new GpuTextureDescriptor(new GpuExtend3DDict {
                    Width = SrcWidth, Height = SrcHeight, Depth = 1
                }, GpuTextureFormat.RGBA8UNorm, GpuTextureUsageFlags.CopyDst | GpuTextureUsageFlags.Storage | GpuTextureUsageFlags.Sampled))
            };
            var buffer0 = Device.CreateBuffer(new GpuBufferDescriptor(4, GpuBufferUsageFlags.Uniform)
            {
                MappedAtCreation = true
            });

            using (var stream = buffer0.GetMappedRange().AsStream())
                using (var writer = new BinaryWriter(stream))
                {
                    writer.Write(0u);
                }
            buffer0.Unmap();

            var buffer1 = Device.CreateBuffer(new GpuBufferDescriptor(4, GpuBufferUsageFlags.Uniform)
            {
                MappedAtCreation = true
            });

            using (var stream = buffer1.GetMappedRange().AsStream())
                using (var writer = new BinaryWriter(stream))
                {
                    writer.Write(1u);
                }
            buffer1.Unmap();

            BlurParamsBuffer = Device.CreateBuffer(new GpuBufferDescriptor(8, GpuBufferUsageFlags.CopyDst | GpuBufferUsageFlags.Uniform));
            ComputeConstants = Device.CreateBindGroup(new GpuBindGroupDescriptor(blurBindGroupLayouts[0], new GpuBindGroupEntry[]
            {
                new GpuBindGroupEntry(0, sampler),
                new GpuBindGroupEntry(1, new GpuBufferBinding(BlurParamsBuffer, BlurParamsBuffer.Size))
            }));
            ComputeBindGroup0 = Device.CreateBindGroup(new GpuBindGroupDescriptor(blurBindGroupLayouts[1], new GpuBindGroupEntry[]
            {
                new GpuBindGroupEntry(1, cubeTexture.CreateView()),
                new GpuBindGroupEntry(2, textures[0].CreateView()),
                new GpuBindGroupEntry(3, new GpuBufferBinding(buffer0, buffer0.Size))
            }));
            ComputeBindGroup1 = Device.CreateBindGroup(new GpuBindGroupDescriptor(blurBindGroupLayouts[1], new GpuBindGroupEntry[]
            {
                new GpuBindGroupEntry(1, textures[0].CreateView()),
                new GpuBindGroupEntry(2, textures[1].CreateView()),
                new GpuBindGroupEntry(3, new GpuBufferBinding(buffer1, buffer1.Size))
            }));
            ComputeBindGroup2 = Device.CreateBindGroup(new GpuBindGroupDescriptor(blurBindGroupLayouts[1], new GpuBindGroupEntry[]
            {
                new GpuBindGroupEntry(1, textures[1].CreateView()),
                new GpuBindGroupEntry(2, textures[0].CreateView()),
                new GpuBindGroupEntry(3, new GpuBufferBinding(buffer0, buffer0.Size))
            }));
            UniformBindGroup = Device.CreateBindGroup(new GpuBindGroupDescriptor(bindGroupLayout, new GpuBindGroupEntry[]
            {
                new GpuBindGroupEntry(0, sampler),
                new GpuBindGroupEntry(1, textures[1].CreateView())
            }));
        }
Esempio n. 9
0
        //

        internal RenderTexture(FrameBuffer frameBuffer, Vector2I size, GpuTexture creator)
            : base(frameBuffer, true, size)
        {
            this.creator = creator;
        }