diff --git a/driver/common.h b/driver/common.h index 134937b..d4e0621 100644 --- a/driver/common.h +++ b/driver/common.h @@ -37,8 +37,8 @@ #include "vkCaps.h" -#define PROFILESTART(x) startMeasure((x), (#x)) -#define PROFILEEND(x) endMeasure((x)) +#define PROFILESTART(x)// startMeasure((x), (#x)) +#define PROFILEEND(x)// endMeasure((x)) /** //scope diff --git a/test/clearTest/CMakeLists.txt b/test/clearTest/CMakeLists.txt index 24ff6b0..a054ecc 100644 --- a/test/clearTest/CMakeLists.txt +++ b/test/clearTest/CMakeLists.txt @@ -9,3 +9,4 @@ target_compile_options(clearTest PRIVATE -Wall -std=c++11 ) target_link_libraries(clearTest vulkan $) +#target_link_libraries(clearTest rpi-vk-driver) diff --git a/test/clearTest/clearTest.cpp b/test/clearTest/clearTest.cpp index 34b0cfd..a95826a 100644 --- a/test/clearTest/clearTest.cpp +++ b/test/clearTest/clearTest.cpp @@ -158,7 +158,7 @@ void setupVulkan() { void mainLoop() { //while (!glfwWindowShouldClose(window)) { - for(int c = 0; c < 300; ++c){ + for(int c = 0; c < 600; ++c){ draw(); //glfwPollEvents(); @@ -841,6 +841,8 @@ void recordCommandBuffers() clearRect.rect.extent.height = 108; vkCmdClearAttachments(presentCommandBuffers[i], 2, clearAttachment, 1, &clearRect); + vkCmdSetDepthBias(presentCommandBuffers[i], 0.0, 0.0, 0.0); + VkDeviceSize offsets = 0; vkCmdBindVertexBuffers(presentCommandBuffers[i], 0, 1, &vertexBuffer1, &offsets ); vkCmdDraw(presentCommandBuffers[i], 3, 1, 0, 0); @@ -848,6 +850,8 @@ void recordCommandBuffers() fragColor = 0xffafcd02; //yellow vkCmdPushConstants(presentCommandBuffers[i], pipelineLayout, VK_SHADER_STAGE_FRAGMENT_BIT, 0, sizeof(fragColor), &fragColor); + vkCmdSetDepthBias(presentCommandBuffers[i], 100.0, 0.0, 100.0); + vkCmdBindVertexBuffers(presentCommandBuffers[i], 0, 1, &vertexBuffer2, &offsets ); vkCmdDraw(presentCommandBuffers[i], 3, 1, 0, 0); @@ -1350,8 +1354,8 @@ void CreatePipeline() rastCreateInfo.frontFace = VK_FRONT_FACE_COUNTER_CLOCKWISE; rastCreateInfo.lineWidth = 1.0f; rastCreateInfo.depthBiasEnable = 1; - rastCreateInfo.depthBiasConstantFactor = -2.0f; - rastCreateInfo.depthBiasSlopeFactor = -1.0f; + rastCreateInfo.depthBiasConstantFactor = 0.0f; + rastCreateInfo.depthBiasSlopeFactor = 0.0f; VkPipelineMultisampleStateCreateInfo pipelineMSCreateInfo = {}; pipelineMSCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO; @@ -1371,6 +1375,11 @@ void CreatePipeline() depthStencilState.depthWriteEnable = true; depthStencilState.stencilTestEnable = false; + VkDynamicState states[] = {VK_DYNAMIC_STATE_DEPTH_BIAS}; + VkPipelineDynamicStateCreateInfo dynamicState = {}; + dynamicState.dynamicStateCount = 1; + dynamicState.pDynamicStates = states; + VkGraphicsPipelineCreateInfo pipelineInfo = {}; pipelineInfo.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO; pipelineInfo.stageCount = 2; @@ -1385,6 +1394,7 @@ void CreatePipeline() pipelineInfo.basePipelineIndex = -1; pipelineInfo.pDepthStencilState = &depthStencilState; pipelineInfo.layout = pipelineLayout; + pipelineInfo.pDynamicState = &dynamicState; VkResult res = vkCreateGraphicsPipelines(device, VK_NULL_HANDLE, 1, &pipelineInfo, NULL, &pipeline); @@ -1434,9 +1444,9 @@ void CreateVertexBuffer() float vertices[] = { - -1, 1, 0.2, - 1, 1, 0.2, - 0, -1, 0.2 + -1, 1, 0.5, + 1, 1, 0.5, + 0, -1, 0.5 }; void* data; diff --git a/test/mintest/CMakeLists.txt b/test/mintest/CMakeLists.txt index a74b397..33b2e5b 100644 --- a/test/mintest/CMakeLists.txt +++ b/test/mintest/CMakeLists.txt @@ -8,4 +8,5 @@ target_compile_options(mintest PRIVATE -Wall -std=c++11 -march=${RPI_ARCH} -fPIC ) -target_link_libraries(mintest rpi-vk-driver) +#target_link_libraries(mintest rpi-vk-driver) +target_link_libraries(mintest vulkan) diff --git a/test/mintest/mintest.cpp b/test/mintest/mintest.cpp index 05aa0b8..c030b42 100644 --- a/test/mintest/mintest.cpp +++ b/test/mintest/mintest.cpp @@ -1,3 +1,4 @@ +#include #include #include @@ -33,6 +34,15 @@ int main() { VkDisplayModePropertiesKHR* displayModeProperties = (VkDisplayModePropertiesKHR*)malloc(sizeof(VkDisplayModePropertiesKHR)*modeCount); vkGetDisplayModePropertiesKHR(physicalDevice, displayProperties[0].display, &modeCount, displayModeProperties); +// printf("\nEnumerated modes\n"); +// for(uint32_t c = 0; c < modeCount; ++c) +// { +// printf("Mode refresh rate %i\n", displayModeProperties[c].parameters.refreshRate); +// printf("Mode width %i\n", displayModeProperties[c].parameters.visibleRegion.width); +// printf("Mode height %i\n\n", displayModeProperties[c].parameters.visibleRegion.height); +// } + + VkDisplaySurfaceCreateInfoKHR dsci = {}; dsci.sType = VK_STRUCTURE_TYPE_DISPLAY_SURFACE_CREATE_INFO_KHR; vkCreateDisplayPlaneSurfaceKHR(instance, &dsci, 0, &windowSurface); diff --git a/test/mipmapping/CMakeLists.txt b/test/mipmapping/CMakeLists.txt index e02febd..c512e6d 100644 --- a/test/mipmapping/CMakeLists.txt +++ b/test/mipmapping/CMakeLists.txt @@ -1,7 +1,6 @@ file(GLOB testSrc "*.h" "*.cpp" - ../inputHandler/inputHandler.c ) add_executable(mipmapping ${testSrc} ) @@ -9,5 +8,5 @@ target_compile_options(mipmapping PRIVATE -Wall -std=c++11 -march=${RPI_ARCH} -fPIC ) -#target_link_libraries(mipmapping vulkan $) -target_link_libraries(mipmapping rpi-vk-driver mtdev evdev udev input) +target_link_libraries(mipmapping vulkan $) +#target_link_libraries(mipmapping rpi-vk-driver) diff --git a/test/mipmapping/mipmapping.cpp b/test/mipmapping/mipmapping.cpp index e469212..66b5c40 100644 --- a/test/mipmapping/mipmapping.cpp +++ b/test/mipmapping/mipmapping.cpp @@ -10,8 +10,6 @@ #include "driver/vkExt.h" #include "QPUassembler/qpu_assembler.h" -#include "../inputHandler/inputHandler.h" - //#define GLFW_INCLUDE_VULKAN //#define VK_USE_PLATFORM_WIN32_KHR //#include @@ -200,11 +198,9 @@ void setupVulkan() { } void mainLoop() { - while(true) + for(int c = 0; c < 300; ++c) { draw(); - - handleInput(); } } @@ -1788,8 +1784,6 @@ void CreateVertexBuffer() } int main() { - initInputHandler(); - // Use Vulkan setupVulkan(); @@ -1797,8 +1791,6 @@ int main() { cleanup(); - uninitInputHandler(); - return 0; }