예제 #1
0
        void setupDescriptorSet()
        {
            var dsl = descriptorSetLayout;
            VkDescriptorSetAllocateInfo allocInfo =
                Initializers.descriptorSetAllocateInfo(
                    descriptorPool,
                    &dsl,
                    1);

            Util.CheckResult(vkAllocateDescriptorSets(device, &allocInfo, out descriptorSet));

            VkDescriptorImageInfo texDescriptor =
                Initializers.descriptorImageInfo(
                    textures_colorMap.sampler,
                    textures_colorMap.view,
                    VkImageLayout.General);

            var temp = uniformBuffers_scene.descriptor;
            FixedArray2 <VkWriteDescriptorSet> writeDescriptorSets = new FixedArray2 <VkWriteDescriptorSet>(
                // Binding 0 : Vertex shader uniform buffer
                Initializers.writeDescriptorSet(
                    descriptorSet,
                    VkDescriptorType.UniformBuffer,
                    0,
                    &temp),
                // Binding 1 : Color map
                Initializers.writeDescriptorSet(
                    descriptorSet,
                    VkDescriptorType.CombinedImageSampler,
                    1,
                    &texDescriptor));

            vkUpdateDescriptorSets(device, (writeDescriptorSets.Count), ref writeDescriptorSets.First, 0, null);
        }
예제 #2
0
        void setupDescriptorSets()
        {
            // Image descriptor for the cube map texture
            VkDescriptorImageInfo textureDescriptor =
                Initializers.descriptorImageInfo(
                    cubeMap.sampler,
                    cubeMap.view,
                    cubeMap.imageLayout);

            var dsl = descriptorSetLayout;
            VkDescriptorSetAllocateInfo allocInfo =
                Initializers.descriptorSetAllocateInfo(
                    descriptorPool,
                    &dsl,
                    1);

            // 3D object descriptor set
            Util.CheckResult(vkAllocateDescriptorSets(device, &allocInfo, out descriptorSets_object));

            var bufferInfo = uniformBuffers_object.descriptor;
            FixedArray2 <VkWriteDescriptorSet> writeDescriptorSets = new FixedArray2 <VkWriteDescriptorSet>
                                                                     (
                // Binding 0 : Vertex shader uniform buffer
                Initializers.writeDescriptorSet(
                    descriptorSets_object,
                    VkDescriptorType.UniformBuffer,
                    0,
                    &bufferInfo),
                // Binding 1 : Fragment shader cubemap sampler
                Initializers.writeDescriptorSet(
                    descriptorSets_object,
                    VkDescriptorType.CombinedImageSampler,
                    1,
                    &textureDescriptor));

            vkUpdateDescriptorSets(device, writeDescriptorSets.Count, ref writeDescriptorSets.First, 0, null);

            // Sky box descriptor set
            Util.CheckResult(vkAllocateDescriptorSets(device, &allocInfo, out descriptorSets_skybox));

            var descriptor = uniformBuffers_skybox.descriptor;

            writeDescriptorSets = new FixedArray2 <VkWriteDescriptorSet>
                                  (
                // Binding 0 : Vertex shader uniform buffer
                Initializers.writeDescriptorSet(
                    descriptorSets_skybox,
                    VkDescriptorType.UniformBuffer,
                    0,
                    &descriptor),
                // Binding 1 : Fragment shader cubemap sampler
                Initializers.writeDescriptorSet(
                    descriptorSets_skybox,
                    VkDescriptorType.CombinedImageSampler,
                    1,
                    &textureDescriptor));

            vkUpdateDescriptorSets(device, writeDescriptorSets.Count, ref writeDescriptorSets.First, 0, null);
        }