Skip to content

Commit

Permalink
Fix OpenGL
Browse files Browse the repository at this point in the history
  • Loading branch information
RobDangerous committed Jan 19, 2024
1 parent 06a3cab commit 38bc2f2
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -396,3 +396,7 @@ bool kinc_g5_command_list_are_query_results_available(kinc_g5_command_list_t *li
}

void kinc_g5_command_list_get_query_result(kinc_g5_command_list_t *list, unsigned occlusionQuery, unsigned *pixelCount) {}

void kinc_g5_command_list_set_compute_shader(kinc_g5_command_list_t *list, struct kinc_g5_compute_shader *shader) {}

void kinc_g5_command_list_compute(kinc_g5_command_list_t *list, int x, int y, int z) {}
28 changes: 28 additions & 0 deletions Backends/Graphics5/G5onG4/Sources/kinc/backend/graphics5/compute.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include <kinc/graphics5/compute.h>
#include <kinc/math/core.h>

#include <assert.h>

void kinc_g5_compute_shader_init(kinc_g5_compute_shader *shader, void *source, int length) {
kinc_g4_compute_shader_init(&shader->impl.g4, source, length);
}

void kinc_g5_compute_shader_destroy(kinc_g5_compute_shader *shader) {
kinc_g4_compute_shader_destroy(&shader->impl.g4);
}

kinc_g5_constant_location_t kinc_g5_compute_shader_get_constant_location(kinc_g5_compute_shader *shader, const char *name) {
kinc_g5_constant_location_t location = {0};
location.impl.location = kinc_g4_compute_shader_get_constant_location(&shader->impl.g4, name);
return location;
}

kinc_g5_texture_unit_t kinc_g5_compute_shader_get_texture_unit(kinc_g5_compute_shader *shader, const char *name) {
kinc_g5_texture_unit_t g5_unit = {0};
kinc_g4_texture_unit_t g4_unit = kinc_g4_compute_shader_get_texture_unit(&shader->impl.g4, name);
assert(KINC_G4_SHADER_TYPE_COUNT == KINC_G5_SHADER_TYPE_COUNT);
for (int i = 0; i < KINC_G4_SHADER_TYPE_COUNT; ++i) {
g5_unit.stages[i] = g4_unit.stages[i];
}
return g5_unit;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once

#include <kinc/graphics4/compute.h>

typedef struct kinc_g5_compute_shader_impl {
kinc_g4_compute_shader g4;
} kinc_g5_compute_shader_impl;
5 changes: 4 additions & 1 deletion Sources/kinc/graphics4/graphics.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ struct kinc_g4_pipeline;
struct kinc_g4_render_target;
struct kinc_g4_texture;
struct kinc_g4_texture_array;
#ifdef KORE_OPENGL
struct kinc_shader_storage_buffer;
#endif
#ifdef KINC_KONG
struct kinc_g4_constant_buffer;
#endif
Expand Down Expand Up @@ -425,7 +428,7 @@ KINC_FUNC void kinc_g4_set_antialiasing_samples(int samples);
/// <summary>
/// Old, hack thing, do not use.
/// </summary>
KINC_FUNC void kinc_g4_set_shader_storage_buffer(kinc_shader_storage_buffer_t *buffer, int index);
KINC_FUNC void kinc_g4_set_shader_storage_buffer(struct kinc_shader_storage_buffer *buffer, int index);
#endif

/// <summary>
Expand Down

0 comments on commit 38bc2f2

Please sign in to comment.