1
0
mirror of https://github.com/Yours3lf/rpi-vk-driver.git synced 2025-02-20 17:54:17 +01:00
This commit is contained in:
yours3lf 2020-05-26 22:53:30 +01:00
parent 488a0334a0
commit 78a7fa4875
7 changed files with 34 additions and 21 deletions

View File

@ -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

View File

@ -9,3 +9,4 @@ target_compile_options(clearTest PRIVATE -Wall -std=c++11
)
target_link_libraries(clearTest vulkan $<TARGET_OBJECTS:QPUassembler>)
#target_link_libraries(clearTest rpi-vk-driver)

View File

@ -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;

View File

@ -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)

View File

@ -1,3 +1,4 @@
#include <stdio.h>
#include <stdlib.h>
#include <vulkan/vulkan.h>
@ -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);

View File

@ -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_OBJECTS:QPUassembler>)
target_link_libraries(mipmapping rpi-vk-driver mtdev evdev udev input)
target_link_libraries(mipmapping vulkan $<TARGET_OBJECTS:QPUassembler>)
#target_link_libraries(mipmapping rpi-vk-driver)

View File

@ -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 <GLFW/glfw3.h>
@ -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;
}