-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Implementing character string (Text) rendering (WIP) * added text_shader.glsl * Added space (' ') whitespace support. * Added new font * Some refactoring * Updated HPML submodule * Updated HPML and MeshLib * Extended shader_compiler and shader_binary file format * Added vulkan_descriptor_set * Refactored for vulkan_descriptor_set * shader_compiler integration testing and bug fixes * Added Serialization headers and Source * Fixed release mode build linking errors * Updated HPML * Added ASSERT_WRN and assert_wrn in assert.h * Added INTERNAL define, which does nothing * Implemented material_set_texture2d() * Refactoring Renamed: stage_shader to vulkan_stage_shader Renamed: shader to vulkan_shader Created new: shader * removed some white space in vulkan_descriptor_set.c * Updated BufferLib submodule * Added uniform buffer support, one can set values in uniform block easily now!
- Loading branch information
Showing
51 changed files
with
4,078 additions
and
579 deletions.
There are no files selected for viewing
Submodule HPML
updated
17 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,172 @@ | ||
#ifndef _SERIALIZATION_H_ | ||
#define _SERIALIZATION_H_ | ||
#include <renderer/defs.h> | ||
#include <buffer.h> | ||
|
||
#define serialized_struct_set_property_int8(struct_name, property_name, value, object_ptr)\ | ||
{\ | ||
int8_t _value = value;\ | ||
serialized_struct_set_property_value(struct_name, property_name,&_value, object_ptr);\ | ||
} | ||
#define serialized_struct_set_property_int16(struct_name, property_name, value, object_ptr)\ | ||
{\ | ||
int16_t _value = value;\ | ||
serialized_struct_set_property_value(struct_name, property_name,&_value, object_ptr);\ | ||
} | ||
#define serialized_struct_set_property_int32(struct_name, property_name, value, object_ptr)\ | ||
{\ | ||
int32_t _value = value;\ | ||
serialized_struct_set_property_value(struct_name, property_name,&_value, object_ptr);\ | ||
} | ||
#define serialized_struct_set_property_int64(struct_name, property_name, value, object_ptr)\ | ||
{\ | ||
int64_t _value = value;\ | ||
serialized_struct_set_property_value(struct_name, property_name,&_value, object_ptr);\ | ||
} | ||
#define serialized_struct_set_property_uint8(struct_name, property_name, value, object_ptr)\ | ||
{\ | ||
uint8_t _value = value;\ | ||
serialized_struct_set_property_value(struct_name, property_name,&_value, object_ptr);\ | ||
} | ||
#define serialized_struct_set_property_uint16(struct_name, property_name, value, object_ptr)\ | ||
{\ | ||
uint16_t _value = value;\ | ||
serialized_struct_set_property_value(struct_name, property_name,&_value, object_ptr);\ | ||
} | ||
#define serialized_struct_set_property_uint32(struct_name, property_name, value, object_ptr)\ | ||
{\ | ||
uint32_t _value = value;\ | ||
serialized_struct_set_property_value(struct_name, property_name,&_value, object_ptr);\ | ||
} | ||
#define serialized_struct_set_property_uint64(struct_name, property_name, value, object_ptr)\ | ||
{\ | ||
uint64_t _value = value;\ | ||
serialized_struct_set_property_value(struct_name, property_name,&_value, object_ptr);\ | ||
} | ||
#define serialized_struct_set_property_float(struct_name, property_name, value, object_ptr)\ | ||
{\ | ||
float _value = value;\ | ||
serialized_struct_set_property_value(struct_name, property_name,&_value, object_ptr);\ | ||
} | ||
#define serialized_struct_set_property_double(struct_name, property_name, value, object_ptr)\ | ||
{\ | ||
double _value = value;\ | ||
serialized_struct_set_property_value(struct_name, property_name,&_value, object_ptr);\ | ||
} | ||
#define serialized_struct_set_property_long_double(struct_name, property_name, value, object_ptr)\ | ||
{\ | ||
long double _value = value;\ | ||
serialized_struct_set_property_value(struct_name, property_name,&_value);\ | ||
} | ||
|
||
#define serialized_struct_get_property_int8(struct_name, property_name, object_ptr) (*(int8_t*)serialized_struct_get_property_value(struct_name, property_name, object_ptr)) | ||
#define serialized_struct_get_property_int16(struct_name, property_name, object_ptr) (*(int16_t*)serialized_struct_get_property_value(struct_name, property_name, object_ptr)) | ||
#define serialized_struct_get_property_int32(struct_name, property_name, object_ptr) (*(int32_t*)serialized_struct_get_property_value(struct_name, property_name, object_ptr)) | ||
#define serialized_struct_get_property_int64(struct_name, property_name, object_ptr) (*(int64_t*)serialized_struct_get_property_value(struct_name, property_name, object_ptr)) | ||
#define serialized_struct_get_property_uint8(struct_name, property_name, object_ptr) (*(uint8_t*)serialized_struct_get_property_value(struct_name, property_name, object_ptr)) | ||
#define serialized_struct_get_property_uint16(struct_name, property_name, object_ptr) (*(uint16_t*)serialized_struct_get_property_value(struct_name, property_name, object_ptr)) | ||
#define serialized_struct_get_property_uint32(struct_name, property_name, object_ptr) (*(uint32_t*)serialized_struct_get_property_value(struct_name, property_name, object_ptr)) | ||
#define serialized_struct_get_property_uint64(struct_name, property_name, object_ptr) (*(uint64_t*)serialized_struct_get_property_value(struct_name, property_name, object_ptr)) | ||
#define serialized_struct_get_property_float(struct_name, property_name, object_ptr) (*(float*)serialized_struct_get_property_value(struct_name, property_name, object_ptr)) | ||
#define serialized_struct_get_property_double(struct_name, property_name, object_ptr) (*(double*)serialized_struct_get_property_value(struct_name, property_name, object_ptr)) | ||
#define serialized_struct_get_property_long_double(struct_name, property_name, object_ptr) (*(long double*)serialized_struct_get_property_value(struct_name, property_name, object_ptr)) | ||
|
||
#define serialized_property_set_int8(property, value)\ | ||
{\ | ||
int8_t _value = value;\ | ||
serialized_property_set_value(property, &_value);\ | ||
} | ||
#define serialized_property_set_int16(property, value)\ | ||
{\ | ||
int16_t _value = value;\ | ||
serialized_property_set_value(property, &_value);\ | ||
} | ||
#define serialized_property_set_int32(property, value)\ | ||
{\ | ||
int32_t _value = value;\ | ||
serialized_property_set_value(property, &_value);\ | ||
} | ||
#define serialized_property_set_int64(property, _value)\ | ||
{\ | ||
int64_t _value = value;\ | ||
serialized_property_set_value(property, &_value);\ | ||
} | ||
#define serialized_property_set_uint8(property, value)\ | ||
{\ | ||
uint8_t _value = value;\ | ||
serialized_property_set_value(property, &_value);\ | ||
} | ||
#define serialized_property_set_uint16(property, value)\ | ||
{\ | ||
uint16_t _value = value;\ | ||
serialized_property_set_value(property, &_value);\ | ||
} | ||
#define serialized_property_set_uint32(property, value)\ | ||
{\ | ||
uint32_t _value = value;\ | ||
serialized_property_set_value(property, &_value);\ | ||
} | ||
#define serialized_property_set_uint64(property, value)\ | ||
{\ | ||
uint64_t _value = value;\ | ||
serialized_property_set_value(property, &_value);\ | ||
} | ||
#define serialized_property_set_float(property, value)\ | ||
{\ | ||
float _value = value;\ | ||
serialized_property_set_value(property, &_value);\ | ||
} | ||
#define serialized_property_set_double(property, value)\ | ||
{\ | ||
double _value = value;\ | ||
serialized_property_set_value(property, &_value);\ | ||
} | ||
#define serialized_property_set_long_double(property, value)\ | ||
{\ | ||
long double _value = value;\ | ||
serialized_property_set_value(property, &_value);\ | ||
} | ||
|
||
#define serialized_property_get_int8(property) (*(int8_t*)serialized_property_get_value(property)) | ||
#define serialized_property_get_int16(property) (*(int16_t*)serialized_property_get_value(property)) | ||
#define serialized_property_get_int32(property) (*(int32_t*)serialized_property_get_value(property)) | ||
#define serialized_property_get_int64(property) (*(int64_t*)serialized_property_get_value(property)) | ||
#define serialized_property_get_uint8(property) (*(uint8_t*)serialized_property_get_value(property)) | ||
#define serialized_property_get_uint16(property) (*(uint16_t*)serialized_property_get_value(property)) | ||
#define serialized_property_get_uint32(property) (*(uint32_t*)serialized_property_get_value(property)) | ||
#define serialized_property_get_uint64(property) (*(uint64_t*)serialized_property_get_value(property)) | ||
#define serialized_property_get_float(property) (*(float*)serialized_property_get_value(property)) | ||
#define serialized_property_get_double(property) (*(double*)serialized_property_get_vaule(property)) | ||
#define serialized_property_get_long_double(property) (*(long double*)serialized_property_get_value(property)) | ||
|
||
//loads the source file from secondary storage to the main memory for further parsing and compiling | ||
void load_serialization_source_file(const char* name); | ||
//sets the internal source buffer | ||
//NOTE: if this buffer is allocated in the heap then it will not be automatically freed, you must have to free it explicitly | ||
void set_serialization_source_buffer(const char* buffer); | ||
//destoyes the allocated buffers for the serialized objects and properties | ||
void destroy_serialization_data(); | ||
//prints the details of a serialized property | ||
void serialized_property_print(SerializedProperty* property); | ||
//prints the details of a serialized struct along with its all property details | ||
void serialized_struct_print(const char* name); | ||
//serializes a struct and stores the retrieved (serialized information) information into a buffer of SerializedStructs | ||
void struct_serialize(const char* struct_name); | ||
//instantiates a new object of type typeof('serialized_struct_name') | ||
//NOTE: that struct must be serialized first | ||
void* instantiate_object(const char* struct_name); | ||
//returns a pointer to the memory bock which corresponds to the property | ||
void* serialized_property_get_value(SerializedProperty* property); | ||
//sets a value of a memory block which corresponds to the property | ||
void serialized_property_set_value(SerializedProperty* property, void* value); | ||
//sets a value to a property in the serialized struct named as 'struct_name' | ||
void serialized_struct_set_property_value(const char* struct_name, const char* property_name, void* value, void* object_ptr); | ||
//returns a pointer to the memory block of property of the struct named as 'struct_name' | ||
void* serialized_struct_get_property_value(const char* struct_name, const char* property_name, void* object_ptr); | ||
//returns the property with name 'property_name' and you have to pass the base address of an object (struct) | ||
SerializedProperty serialized_struct_get_property(const char* serialized_struct_name, const char* property_name, void* object_ptr); | ||
|
||
SerializedStruct* serialized_struct_get(const char* name); | ||
|
||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,3 +17,8 @@ typedef int8_t s8; | |
|
||
typedef float f32; | ||
typedef double f64; | ||
typedef u32 uint; | ||
|
||
|
||
|
||
#define INTERNAL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
#ifndef _DEFS_H_ | ||
#define _DEFS_H_ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <stdbool.h> | ||
#include <stdint.h> | ||
#include <conio.h> | ||
#include <string.h> | ||
#include <ctype.h> | ||
#include <buffer.h> | ||
|
||
#define TOKEN_BUFFER_SIZE 80 | ||
#define SINGLE_LINE_COMMENT "\\" | ||
#define MULTIPLE_LINE_COMMENT "/**/" | ||
#define VERSION(__version__) | ||
|
||
#define _sizeof(serialized_property) __sizeof(serialized_property) | ||
|
||
#ifdef DEBUG | ||
#define GOTO(label) { printf("Returned from %d\n", __LINE__); goto label; } | ||
#else | ||
#define GOTO(label) { goto label; } | ||
#endif | ||
|
||
#define INCREMENT_CHAR_PTR(ch, amount)\ | ||
do {\ | ||
if((ch == NULL) || (*ch == 0)) { exit(0); puts("FILE ENDED"); }\ | ||
ch += amount;\ | ||
if(*ch == 0) { exit(0); puts("FILE ENDED");} } while (false) | ||
|
||
#ifdef DEBUG | ||
#define throw_error(error_str, line_no, discription)\ | ||
do{\ | ||
printf("[ERROR]: Parsing error at line no %d \n%s: %s\n", line_no, error_str, discription);\ | ||
exit(0);\ | ||
}while(false) | ||
#else | ||
#define throw_error(error_str, line_no, description) | ||
#endif | ||
|
||
typedef enum | ||
{ | ||
STSP_STATIC = 0, | ||
STSP_REGISTER = 1, | ||
STSP_EXTERN = 2, | ||
STSP_NONE = 3 | ||
} _storage_specifiers; | ||
|
||
typedef enum | ||
{ | ||
TYPE_SIGNED_INT8 = 0, //char, signed char | ||
TYPE_SIGNED_INT16 = 1, //short, signed short, short int, signed short int | ||
TYPE_SIGNED_INT32 = 2, //int, signed int, long, long int | ||
TYPE_SIGNED_INT64 = 3, //long long int | ||
|
||
TYPE_UNSIGNED_INT8 = 4, //unsigned char | ||
TYPE_UNSIGNED_INT16 = 5, //unsigned short, unsigned short int | ||
TYPE_UNSIGNED_INT32 = 6, //unsigned int, unsigned long, unsigned long int | ||
TYPE_UNSIGNED_INT64 = 7, //unsigned long long, unsigned long long int | ||
|
||
TYPE_FLOAT = 8, //float | ||
TYPE_DOUBLE = 9, //double | ||
TYPE_LONG_DOUBLE = 10, //long double | ||
TYPE_STRING = 11, | ||
TYPE_NONE = 12, | ||
TYPE_INCOMPLETE = 13, | ||
TYPE_VOID = 14 | ||
} _type_specifiers; | ||
|
||
typedef struct | ||
{ | ||
bool is_pointer; //true if this property is a pointer | ||
bool is_const; //true if this property is a constant property | ||
_storage_specifiers storage; //extern, static, register | ||
_type_specifiers type; //int, short, long ...etc | ||
intptr_t address; //address of the property | ||
char name[TOKEN_BUFFER_SIZE]; //name of the property | ||
} SerializedProperty; | ||
|
||
typedef struct | ||
{ | ||
char name[TOKEN_BUFFER_SIZE]; //name of this struct | ||
bool is_valid; //true, if this SerializedStruct is a valid serialized struct | ||
uint32_t size; //size of the serialized struct in bytes | ||
BUFFER* properties; //list of properties | ||
} SerializedStruct; | ||
|
||
char* defs_load_text_from_file(const char* file_name); | ||
char* defs_load_text_from_file_exclude_comments(const char* file_name); | ||
|
||
int __sizeof(SerializedProperty* property); | ||
bool isstorage(const char* string, _storage_specifiers* storage); | ||
bool istype(const char* string, _type_specifiers* type); | ||
|
||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
|
||
|
||
#pragma once | ||
|
||
#include <renderer/defines.h> | ||
#include <vulkan/vulkan_wrapper.h> | ||
|
||
typedef struct renderer_t renderer_t; | ||
typedef struct vulkan_texture_t vulkan_texture_t; | ||
typedef struct vulkan_buffer_t vulkan_buffer_t; | ||
typedef struct vulkan_pipeline_layout_t vulkan_pipeline_layout_t; | ||
|
||
typedef struct vulkan_descriptor_set_create_info_t | ||
{ | ||
VkDescriptorPool pool; | ||
VkDescriptorSetLayout layout; | ||
} vulkan_descriptor_set_create_info_t; | ||
|
||
typedef struct vulkan_descriptor_set_t | ||
{ | ||
VkDescriptorSet handle; | ||
VkDescriptorPool pool; //the pool from it has been allocated | ||
} vulkan_descriptor_set_t; | ||
|
||
|
||
|
||
vulkan_descriptor_set_t* vulkan_descriptor_set_new(); | ||
vulkan_descriptor_set_t* vulkan_descriptor_set_create(renderer_t* renderer, vulkan_descriptor_set_create_info_t* create_info); | ||
void vulkan_descriptor_set_create_no_alloc(renderer_t* renderer, vulkan_descriptor_set_create_info_t* create_info, vulkan_descriptor_set_t* set); | ||
void vulkan_descriptor_set_destroy(vulkan_descriptor_set_t* set, renderer_t* renderer); | ||
void vulkan_descriptor_set_release_resources(vulkan_descriptor_set_t* set); | ||
|
||
void vulkan_descriptor_set_bind(vulkan_descriptor_set_t* set, renderer_t* renderer, vulkan_pipeline_layout_t* pipeline_layout); | ||
void vulkan_descriptor_set_write_texture(vulkan_descriptor_set_t* set, renderer_t* renderer, u32 binding_index, vulkan_texture_t* texture); | ||
void vulkan_descriptor_set_write_uniform_buffer(vulkan_descriptor_set_t* set, renderer_t* renderer, u32 binding_index, vulkan_buffer_t* buffer); |
Oops, something went wrong.