Changeset 5b02676 in opengl-game for vulkan-ref.cpp


Ignore:
Timestamp:
Oct 4, 2019, 8:10:09 PM (5 years ago)
Author:
Dmitry Portnoy <dmitry.portnoy@…>
Branches:
feature/imgui-sdl, master, points-test
Children:
83b5b4b
Parents:
ee75487
Message:

Make vulkangame and openglgame compile on OSX with the new GraphicsPipeline classes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vulkan-ref.cpp

    ree75487 r5b02676  
    6161    vector<VkPresentModeKHR> presentModes;
    6262};
    63 /*** END OF REFACTORED CODE ***/
    6463
    6564struct Vertex {
     
    7372   glm::vec2 texCoord;
    7473};
     74/*** END OF REFACTORED CODE ***/
    7575
    7676struct UniformBufferObject {
     
    174174      vector<VkImage> swapChainImages;
    175175      VkFormat swapChainImageFormat;
    176       VkExtent2D swapChainExtent;
     176/*** END OF REFACTORED CODE ***/
     177      VkExtent2D swapChainExtent; // (This was taken out of vulkan-game for now and replaced with Viewport)
     178/*** START OF REFACTORED CODE ***/
    177179      vector<VkImageView> swapChainImageViews;
    178180/*** END OF REFACTORED CODE ***/
     
    369371            sceneIndices.data(), sizeof(uint16_t), sceneIndices.size());
    370372
     373/*** START OF REFACTORED CODE ***/
    371374         addAttributeDescription(scenePipeline, VK_FORMAT_R32G32B32_SFLOAT, offset_of(&Vertex::pos));
    372375         addAttributeDescription(scenePipeline, VK_FORMAT_R32G32B32_SFLOAT, offset_of(&Vertex::color));
    373376         addAttributeDescription(scenePipeline, VK_FORMAT_R32G32_SFLOAT, offset_of(&Vertex::texCoord));
     377/*** END OF REFACTORED CODE ***/
    374378
    375379         addDescriptorInfo(scenePipeline, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, VK_SHADER_STAGE_VERTEX_BIT, &uniformBufferInfoList, nullptr);
     
    394398            overlayIndices.data(), sizeof(uint16_t), overlayIndices.size());
    395399
     400/*** START OF REFACTORED CODE ***/
    396401         addAttributeDescription(overlayPipeline, VK_FORMAT_R32G32B32_SFLOAT, offset_of(&OverlayVertex::pos));
    397402         addAttributeDescription(overlayPipeline, VK_FORMAT_R32G32_SFLOAT, offset_of(&OverlayVertex::texCoord));
     403/*** END OF REFACTORED CODE ***/
    398404
    399405         addDescriptorInfo(overlayPipeline, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, VK_SHADER_STAGE_FRAGMENT_BIT, nullptr, &overlayImageInfo);
     
    809815            const void* vertexData, int vertexSize, size_t numVertices,
    810816            const void* indexData, int indexSize, size_t numIndices) {
     817/*** START OF REFACTORED CODE ***/
    811818         // Since there is only one array of vertex data, we use binding = 0
    812819         // I'll probably do that for the foreseeable future
     
    816823         info.bindingDescription.stride = vertexSize;
    817824         info.bindingDescription.inputRate = VK_VERTEX_INPUT_RATE_VERTEX;
     825/*** END OF REFACTORED CODE ***/
    818826
    819827         info.numVertices = numVertices;
     
    886894         VkPipelineVertexInputStateCreateInfo vertexInputInfo = {};
    887895         vertexInputInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO;
    888 /*** END OF REFACTORED CODE ***/
    889896
    890897         vertexInputInfo.vertexBindingDescriptionCount = 1;
     
    968975         pipelineLayoutInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO;
    969976         pipelineLayoutInfo.setLayoutCount = 1;
     977/*** END OF REFACTORED CODE ***/
    970978         pipelineLayoutInfo.pSetLayouts = &info.descriptorSetLayout;
    971979         pipelineLayoutInfo.pushConstantRangeCount = 0;
Note: See TracChangeset for help on using the changeset viewer.