1
0

vulkan shader

This commit is contained in:
Niklas Birk 2020-03-18 14:07:11 +01:00
parent 0382508e9e
commit 7ab2e09d48
4 changed files with 23 additions and 9 deletions

View File

@ -11,9 +11,17 @@ add_executable(Informatikprojekt_OpenGL openglMain.c ${PROJECT_SOURCES_OPENGL})
add_executable(Informatikprojekt_Vulkan vulkanMain.c ${PROJECT_SOURCES_VULKAN})
# Copy shader file to output directory
configure_file(./shaders/opengl/ComputeShader.glsl ComputeShader.glsl COPYONLY)
configure_file(./shaders/opengl/VertexShader.glsl VertexShader.glsl COPYONLY)
configure_file(./shaders/opengl/FragmentShader.glsl FragmentShader.glsl COPYONLY)
## OpenGL
configure_file(./shaders/opengl/ComputeShader.glsl ./opengl/ComputeShader.glsl COPYONLY)
configure_file(./shaders/opengl/VertexShader.glsl ./opengl/VertexShader.glsl COPYONLY)
configure_file(./shaders/opengl/FragmentShader.glsl ./opengl/FragmentShader.glsl COPYONLY)
## Vulkan
configure_file(./shaders/vulkan/ComputeShader.comp ./vulkan/ComputeShader.comp COPYONLY)
configure_file(./shaders/vulkan/VertexShader.vert ./vulkan/VertexShader.vert COPYONLY)
configure_file(./shaders/vulkan/FragmentShader.frag ./vulkan/FragmentShader.frag COPYONLY)
configure_file(./shaders/vulkan/runCompiler.bat ./vulkan/runCompiler.bat COPYONLY)
execute_process(COMMAND runCompiler.bat WORKING_DIRECTORY ./vulkan)
# Vulkan
find_package(Vulkan REQUIRED)

View File

@ -1,4 +1,3 @@
#include <stdlib.h>
#include "particlesystem.h"
#include "initOpenGL.h"
#include "utils.h"
@ -29,9 +28,9 @@ int main()
initRandomParticles(e1);
/************* SHADER *************/
const GLchar *computeShaderSource = readFile("ComputeShader.glsl");
const GLchar *vertexShaderSource = readFile("VertexShader.glsl");
const GLchar *fragmentShaderSource = readFile("FragmentShader.glsl");
const GLchar *computeShaderSource = readFile("./opengl/ComputeShader.glsl");
const GLchar *vertexShaderSource = readFile("./opengl/VertexShader.glsl");
const GLchar *fragmentShaderSource = readFile("./opengl/FragmentShader.glsl");
GLuint computeShader = compileShader(computeShaderSource, GL_COMPUTE_SHADER);
GLuint vertexShader = compileShader(vertexShaderSource, GL_VERTEX_SHADER);

View File

@ -0,0 +1,9 @@
#version 460
layout(location = 0) in vec3 colV;
layout(location = 0) out vec4 colOut;
void main(void)
{
colOut = vec4(colV, 1);
}

View File

@ -4,8 +4,6 @@
#include <string.h>
#include "utils.h"
#define BUFFER_SIZE 1024
char *readFile(char *filename)
{
FILE *file;