Changeset cd487fb in opengl-game


Ignore:
Timestamp:
Nov 12, 2019, 9:48:50 PM (5 years ago)
Author:
Dmitry Portnoy <dmitry.portnoy@…>
Branches:
feature/imgui-sdl, master, points-test
Children:
b8777b7
Parents:
e3bef3a
git-author:
Dmitry Portnoy <dmitry.portnoy@…> (11/12/19 21:25:58)
git-committer:
Dmitry Portnoy <dmitry.portnoy@…> (11/12/19 21:48:50)
Message:

Replace some couts with runtime_exceptions and, in vulkangame, only call SDL_SetRenderTarget once, during initialization

Files:
5 edited

Legend:

Unmodified
Added
Removed
  • TODO.txt

    re3bef3a rcd487fb  
    1818   -Maybe separate out the camera controls
    1919-Turn the game into more of an overhead view RTS where you can use the mouse to select and move ships
    20 
    21 Apparently a new pipeline is required for every type of shader
    22 However, it seems like I should only need one swap chain
    23 Seems like I'll have to create a new set of framebuffers and a new set of command buffers as well
    24 
    25 I will definitely have to create new command buffers, since that's where I specify the vertex buffers and
    26 index buffer for the draw operation
    27 
    28 We'll need to have a separate command buffer for every framebuffer in the swapchain
    29 
    30 Actually, I could probably just have multiple vkCmdDraw calls in each command buffer and rebind to a different
    31 pipeline between each one
  • graphics-pipeline_vulkan.cpp

    re3bef3a rcd487fb  
    33#include <fstream>
    44#include <stdexcept>
    5 #include <iostream>
    65
    76using namespace std;
    8 
    9 // TODO: Remove any instances of cout and instead throw exceptions
    107
    118GraphicsPipeline_Vulkan::GraphicsPipeline_Vulkan(VkPhysicalDevice physicalDevice, VkDevice device,
     
    315312               break;
    316313            default:
    317                cout << "Unknown descriptor type: " << descriptorWrites[j].descriptorType << endl;
     314               throw runtime_error("Unknown descriptor type: " + to_string(descriptorWrites[j].descriptorType));
    318315         }
    319316      }
  • graphics-pipeline_vulkan.hpp

    re3bef3a rcd487fb  
    44#include "graphics-pipeline.hpp"
    55
    6 #include <iostream>
     6#include <stdexcept>
    77#include <vector>
    88
     
    1212
    1313using namespace std;
    14 
    15 // TODO: Remove any instances of cout and instead throw exceptions
    1614
    1715// TODO: Maybe change the name of this struct so I can call the list something other than descriptorInfoList
     
    113111bool GraphicsPipeline_Vulkan::addObject(const vector<VertexType>& vertices, vector<uint16_t>& indices,
    114112      VkCommandPool commandPool, VkQueue graphicsQueue) {
    115    cout << "Adding object to pipeline..." << endl;
    116113
    117114   if (numVertices + vertices.size() > vertexCapacity) {
    118       cout << "ERROR: Need to resize vertex buffers" << endl;
     115      throw runtime_error("ERROR: Need to resize vertex buffers");
    119116   } else if (numIndices + indices.size() > indexCapacity) {
    120       cout << "ERROR: Need to resize index buffers" << endl;
     117      throw runtime_error("ERROR: Need to resize index buffers");
    121118   } else {
    122       cout << "Added object to scene" << endl;
    123 
    124119      for (uint16_t& idx : indices) {
    125120         idx += numVertices;
  • vulkan-game.cpp

    re3bef3a rcd487fb  
    165165      return RTWO_ERROR;
    166166   }
     167
     168   SDL_SetRenderTarget(renderer, uiOverlay);
    167169
    168170   return RTWO_SUCCESS;
     
    333335
    334336void VulkanGame::renderUI() {
    335    // TODO: Since I currently don't use any other render targets,
    336    // I may as well set this once before the render loop
    337    SDL_SetRenderTarget(renderer, uiOverlay);
    338 
    339337   SDL_SetRenderDrawColor(renderer, 0x00, 0x00, 0x00, 0x00);
    340338   SDL_RenderClear(renderer);
  • vulkan-ref.cpp

    re3bef3a rcd487fb  
    17161716
    17171717      void mainLoop() {
    1718          // TODO: Create some generic event-handling functions in game-gui-*
     1718         // TODO: Create some generic event-handling functions in game-gui
    17191719         SDL_Event e;
    17201720         bool quit = false;
Note: See TracChangeset for help on using the changeset viewer.