Commit e3971c80 authored by GERHarcos's avatar GERHarcos

Tests

parent c6de9282
......@@ -4,13 +4,13 @@ layout(local_size_x = 1, local_size_y = 1) in;
//internal image format
layout(rgba32f, binding = 0) uniform image2D img_output;
vec3 ray_d = vec3(0.0, 0.0, -1.0); // ortho
vec3 sphere_c = vec3(0.0, 0.0, -10.0);
vec3 ray_d = vec3(0.0, 0.0, 1.0); // ortho
vec3 sphere_c = vec3(0.0, 0.0, 10.0);
float sphere_r = 1.0;
void main() {
// base pixel colour for image
vec4 pixel = vec4(0.0, 0.0, 0.0, 1.0);
vec4 pixel = vec4(1.0, 0.0, 0.0, 1.0);
// get index in global work group i.e x,y position
ivec2 pixel_coords = ivec2(gl_GlobalInvocationID.xy);
......@@ -30,7 +30,7 @@ void main() {
float bsqmc = b * b - c;
// hit one or both sides
if (bsqmc >= 0.0) {
pixel = vec4(0.4, 0.4, 1.0, 1.0);
pixel = vec4(0.0, 0.0, 1.0, 1.0);
}
// output to a specific pixel in the image
......
......@@ -219,6 +219,9 @@ bool rt::rt_window::init(int sizeX, int sizeY, std::string name)
checkError("glClearColor");
generateTexture();
queryWorkGroups();
initComputeShader();
return GL_TRUE;
......@@ -261,8 +264,8 @@ void rt::rt_window::generateTexture()
glBindTexture(GL_TEXTURE_2D, texture);
//set texture clamp to border
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
//set pixel filter to linear
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
......@@ -277,6 +280,26 @@ void rt::rt_window::generateTexture()
glBindImageTexture(0, texture, 0, GL_FALSE, 0, GL_WRITE_ONLY, GL_RGBA32F);
}
void rt::rt_window::queryWorkGroups()
{
int work_grp_size[3], work_grp_inv;
// maximum global work group (total work in a dispatch)
glGetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_COUNT, 0, &work_grp_size[0]);
glGetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_COUNT, 1, &work_grp_size[1]);
glGetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_COUNT, 2, &work_grp_size[2]);
printf("max global (total) work group size x:%i y:%i z:%i\n", work_grp_size[0],
work_grp_size[1], work_grp_size[2]);
// maximum local work group (one shader's slice)
glGetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_SIZE, 0, &work_grp_size[0]);
glGetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_SIZE, 1, &work_grp_size[1]);
glGetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_SIZE, 2, &work_grp_size[2]);
printf("max local (in one shader) work group sizes x:%i y:%i z:%i\n",
work_grp_size[0], work_grp_size[1], work_grp_size[2]);
// maximum compute shader invocations (x * y * z)
glGetIntegerv(GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS, &work_grp_inv);
printf("max computer shader invocations %i\n", work_grp_inv);
}
void rt::rt_window::initComputeShader()
{
char* computeShaderSource = readShaderFromFile("Shader/compute.glsl");
......
......@@ -66,6 +66,7 @@ namespace rt
//methods related to raytracing
void generateTexture();
void queryWorkGroups();
void initComputeShader();
//methods to run the initialized program
......
 OpenGL_Raytracer.cpp
glCalls.cpp
Code wird generiert...
OpenGL_Raytracer.vcxproj -> C:\Users\eleph\source\repos\OpenGL_Raytracer\x64\Debug\OpenGL_Raytracer.exe
 glCalls.cpp
OpenGL_Raytracer.vcxproj -> D:\Freiberg\Multimeida\Raytracing\mm_raytracer\OpenGL_Raytracer\x64\Debug\OpenGL_Raytracer.exe
B^C:\USERS\ELEPH\SOURCE\REPOS\OPENGL_RAYTRACER\OPENGL_RAYTRACER\GLAD.C
......
B^D:\FREIBERG\MULTIMEIDA\RAYTRACING\MM_RAYTRACER\OPENGL_RAYTRACER\OPENGL_RAYTRACER\GLAD.C
......
B^D:\FREIBERG\MULTIMEIDA\RAYTRACING\MM_RAYTRACER\OPENGL_RAYTRACER\OPENGL_RAYTRACER\GLAD.C
......
#TargetFrameworkVersion=v4.0:PlatformToolSet=v142:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=10.0
Debug|x64|C:\Users\eleph\source\repos\OpenGL_Raytracer\|
Debug|x64|D:\Freiberg\Multimeida\Raytracing\mm_raytracer\OpenGL_Raytracer\|
B^C:\USERS\ELEPH\SOURCE\REPOS\OPENGL_RAYTRACER\OPENGL_RAYTRACER\X64\DEBUG\GLAD.OBJ|C:\USERS\ELEPH\SOURCE\REPOS\OPENGL_RAYTRACER\OPENGL_RAYTRACER\X64\DEBUG\GLCALLS.OBJ|C:\USERS\ELEPH\SOURCE\REPOS\OPENGL_RAYTRACER\OPENGL_RAYTRACER\X64\DEBUG\OPENGL_RAYTRACER.OBJ
......
B^D:\FREIBERG\MULTIMEIDA\RAYTRACING\MM_RAYTRACER\OPENGL_RAYTRACER\OPENGL_RAYTRACER\X64\DEBUG\GLAD.OBJ|D:\FREIBERG\MULTIMEIDA\RAYTRACING\MM_RAYTRACER\OPENGL_RAYTRACER\OPENGL_RAYTRACER\X64\DEBUG\GLCALLS.OBJ|D:\FREIBERG\MULTIMEIDA\RAYTRACING\MM_RAYTRACER\OPENGL_RAYTRACER\OPENGL_RAYTRACER\X64\DEBUG\OPENGL_RAYTRACER.OBJ
......
B^D:\FREIBERG\MULTIMEIDA\RAYTRACING\MM_RAYTRACER\OPENGL_RAYTRACER\OPENGL_RAYTRACER\X64\DEBUG\GLAD.OBJ|D:\FREIBERG\MULTIMEIDA\RAYTRACING\MM_RAYTRACER\OPENGL_RAYTRACER\OPENGL_RAYTRACER\X64\DEBUG\GLCALLS.OBJ|D:\FREIBERG\MULTIMEIDA\RAYTRACING\MM_RAYTRACER\OPENGL_RAYTRACER\OPENGL_RAYTRACER\X64\DEBUG\OPENGL_RAYTRACER.OBJ
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment