diff options
author | Ray Molenkamp <github@lazydodo.com> | 2018-06-16 21:44:20 +0300 |
---|---|---|
committer | Ray Molenkamp <github@lazydodo.com> | 2018-06-16 21:44:20 +0300 |
commit | 45591cc0dfc6065fa34697b93ef9b23b50f38b72 (patch) | |
tree | 05d62315cd7bcc4d775e0540da94de0a04f23799 /intern | |
parent | c90d348e040eec913da349c172f9fc0c7501758f (diff) |
GLRefactor: Remove all GL types from gawains public headers.
In preparation for possible alternative back-ends, the dependency on glew.h needs to be confined to as few libraries as possible. This patch removes all gl types from the public gawain headers.
It'll need some more refactoring later on, but for now this will suffice.
Reviewer: brecht, fclem
Differential Revision: https://developer.blender.org/D3482
Diffstat (limited to 'intern')
-rw-r--r-- | intern/gawain/gawain/gwn_batch.h | 14 | ||||
-rw-r--r-- | intern/gawain/gawain/gwn_element.h | 4 | ||||
-rw-r--r-- | intern/gawain/gawain/gwn_immediate.h | 2 | ||||
-rw-r--r-- | intern/gawain/gawain/gwn_shader_interface.h | 10 | ||||
-rw-r--r-- | intern/gawain/gawain/gwn_vertex_buffer.h | 12 | ||||
-rw-r--r-- | intern/gawain/src/gwn_batch.c | 4 | ||||
-rw-r--r-- | intern/gawain/src/gwn_shader_interface.c | 2 |
7 files changed, 24 insertions, 24 deletions
diff --git a/intern/gawain/gawain/gwn_batch.h b/intern/gawain/gawain/gwn_batch.h index 07ef96061b7..e0cf66637f6 100644 --- a/intern/gawain/gawain/gwn_batch.h +++ b/intern/gawain/gawain/gwn_batch.h @@ -31,11 +31,11 @@ typedef struct Gwn_Batch { Gwn_VertBuf* verts[GWN_BATCH_VBO_MAX_LEN]; // verts[0] is required, others can be NULL Gwn_VertBuf* inst; // instance attribs Gwn_IndexBuf* elem; // NULL if element list not needed - GLenum gl_prim_type; + uint32_t gl_prim_type; // cached values (avoid dereferencing later) - GLuint vao_id; - GLuint program; + uint32_t vao_id; + uint32_t program; const struct Gwn_ShaderInterface* interface; // book-keeping @@ -52,13 +52,13 @@ typedef struct Gwn_Batch { // Static handle count struct { const struct Gwn_ShaderInterface* interfaces[GWN_BATCH_VAO_STATIC_LEN]; - GLuint vao_ids[GWN_BATCH_VAO_STATIC_LEN]; + uint32_t vao_ids[GWN_BATCH_VAO_STATIC_LEN]; } static_vaos; // Dynamic handle count struct { unsigned count; const struct Gwn_ShaderInterface** interfaces; - GLuint* vao_ids; + uint32_t* vao_ids; } dynamic_vaos; }; @@ -95,8 +95,8 @@ int GWN_batch_vertbuf_add_ex(Gwn_Batch*, Gwn_VertBuf*, bool own_vbo); #define GWN_batch_vertbuf_add(batch, verts) \ GWN_batch_vertbuf_add_ex(batch, verts, false) -void GWN_batch_program_set_no_use(Gwn_Batch*, GLuint program, const Gwn_ShaderInterface*); -void GWN_batch_program_set(Gwn_Batch*, GLuint program, const Gwn_ShaderInterface*); +void GWN_batch_program_set_no_use(Gwn_Batch*, uint32_t program, const Gwn_ShaderInterface*); +void GWN_batch_program_set(Gwn_Batch*, uint32_t program, const Gwn_ShaderInterface*); // Entire batch draws with one shader program, but can be redrawn later with another program. // Vertex shader's inputs must be compatible with the batch's vertex format. diff --git a/intern/gawain/gawain/gwn_element.h b/intern/gawain/gawain/gwn_element.h index a80da71e0e8..4bd0c34675a 100644 --- a/intern/gawain/gawain/gwn_element.h +++ b/intern/gawain/gawain/gwn_element.h @@ -27,12 +27,12 @@ typedef struct Gwn_IndexBuf { unsigned index_ct; #if GWN_TRACK_INDEX_RANGE Gwn_IndexBufType index_type; - GLenum gl_index_type; + uint32_t gl_index_type; unsigned min_index; unsigned max_index; unsigned base_index; #endif - GLuint vbo_id; // 0 indicates not yet sent to VRAM + uint32_t vbo_id; // 0 indicates not yet sent to VRAM bool use_prim_restart; } Gwn_IndexBuf; diff --git a/intern/gawain/gawain/gwn_immediate.h b/intern/gawain/gawain/gwn_immediate.h index 7866f83e774..35f9c9d9e2c 100644 --- a/intern/gawain/gawain/gwn_immediate.h +++ b/intern/gawain/gawain/gwn_immediate.h @@ -20,7 +20,7 @@ Gwn_VertFormat* immVertexFormat(void); // returns a cleared vertex format, ready for add_attrib -void immBindProgram(GLuint program, const Gwn_ShaderInterface*); // every immBegin must have a program bound first +void immBindProgram(uint32_t program, const Gwn_ShaderInterface*); // every immBegin must have a program bound first void immUnbindProgram(void); // call after your last immEnd, or before binding another program void immBegin(Gwn_PrimType, unsigned vertex_ct); // must supply exactly vertex_ct vertices diff --git a/intern/gawain/gawain/gwn_shader_interface.h b/intern/gawain/gawain/gwn_shader_interface.h index 150b3b4fcc0..ee3d51fb3cc 100644 --- a/intern/gawain/gawain/gwn_shader_interface.h +++ b/intern/gawain/gawain/gwn_shader_interface.h @@ -48,16 +48,16 @@ typedef struct Gwn_ShaderInput { uint32_t name_offset; unsigned name_hash; Gwn_UniformBuiltin builtin_type; // only for uniform inputs - GLenum gl_type; // only for attrib inputs - GLint size; // only for attrib inputs - GLint location; + uint32_t gl_type; // only for attrib inputs + int32_t size; // only for attrib inputs + int32_t location; } Gwn_ShaderInput; #define GWN_NUM_SHADERINTERFACE_BUCKETS 257 #define GWN_SHADERINTERFACE_REF_ALLOC_COUNT 16 typedef struct Gwn_ShaderInterface { - GLint program; + int32_t program; uint32_t name_buffer_offset; Gwn_ShaderInput* attrib_buckets[GWN_NUM_SHADERINTERFACE_BUCKETS]; Gwn_ShaderInput* uniform_buckets[GWN_NUM_SHADERINTERFACE_BUCKETS]; @@ -68,7 +68,7 @@ typedef struct Gwn_ShaderInterface { unsigned batches_ct; } Gwn_ShaderInterface; -Gwn_ShaderInterface* GWN_shaderinterface_create(GLint program_id); +Gwn_ShaderInterface* GWN_shaderinterface_create(int32_t program_id); void GWN_shaderinterface_discard(Gwn_ShaderInterface*); const Gwn_ShaderInput* GWN_shaderinterface_uniform(const Gwn_ShaderInterface*, const char* name); diff --git a/intern/gawain/gawain/gwn_vertex_buffer.h b/intern/gawain/gawain/gwn_vertex_buffer.h index e9a37519b36..87606ed47c8 100644 --- a/intern/gawain/gawain/gwn_vertex_buffer.h +++ b/intern/gawain/gawain/gwn_vertex_buffer.h @@ -34,8 +34,8 @@ typedef struct Gwn_VertBuf { unsigned vertex_ct; // number of verts we want to draw unsigned vertex_alloc; // number of verts data bool dirty; - GLubyte* data; // NULL indicates data in VRAM (unmapped) - GLuint vbo_id; // 0 indicates not yet allocated + uchar* data; // NULL indicates data in VRAM (unmapped) + uint32_t vbo_id; // 0 indicates not yet allocated Gwn_UsageType usage; // usage hint for GL optimisation } Gwn_VertBuf; @@ -71,17 +71,17 @@ void GWN_vertbuf_attr_fill_stride(Gwn_VertBuf*, unsigned a_idx, unsigned stride, typedef struct Gwn_VertBufRaw { unsigned size; unsigned stride; - GLubyte* data; - GLubyte* data_init; + uchar* data; + uchar* data_init; #if TRUST_NO_ONE // Only for overflow check - GLubyte* _data_end; + uchar* _data_end; #endif } Gwn_VertBufRaw; GWN_INLINE void *GWN_vertbuf_raw_step(Gwn_VertBufRaw *a) { - GLubyte* data = a->data; + uchar* data = a->data; a->data += a->stride; #if TRUST_NO_ONE assert(data < a->_data_end); diff --git a/intern/gawain/src/gwn_batch.c b/intern/gawain/src/gwn_batch.c index 64d5d146578..adc72e171c0 100644 --- a/intern/gawain/src/gwn_batch.c +++ b/intern/gawain/src/gwn_batch.c @@ -283,7 +283,7 @@ static GLuint batch_vao_get(Gwn_Batch *batch) return new_vao; } -void GWN_batch_program_set_no_use(Gwn_Batch* batch, GLuint program, const Gwn_ShaderInterface* shaderface) +void GWN_batch_program_set_no_use(Gwn_Batch* batch, uint32_t program, const Gwn_ShaderInterface* shaderface) { #if TRUST_NO_ONE assert(glIsProgram(shaderface->program)); @@ -295,7 +295,7 @@ void GWN_batch_program_set_no_use(Gwn_Batch* batch, GLuint program, const Gwn_Sh batch->vao_id = batch_vao_get(batch); } -void GWN_batch_program_set(Gwn_Batch* batch, GLuint program, const Gwn_ShaderInterface* shaderface) +void GWN_batch_program_set(Gwn_Batch* batch, uint32_t program, const Gwn_ShaderInterface* shaderface) { GWN_batch_program_set_no_use(batch, program, shaderface); GWN_batch_program_use_begin(batch); // hack! to make Batch_Uniform* simpler diff --git a/intern/gawain/src/gwn_shader_interface.c b/intern/gawain/src/gwn_shader_interface.c index 95c18cf1d39..16451573bba 100644 --- a/intern/gawain/src/gwn_shader_interface.c +++ b/intern/gawain/src/gwn_shader_interface.c @@ -193,7 +193,7 @@ static const Gwn_ShaderInput* add_uniform(Gwn_ShaderInterface* shaderface, const return input; } -Gwn_ShaderInterface* GWN_shaderinterface_create(GLint program) +Gwn_ShaderInterface* GWN_shaderinterface_create(int32_t program) { Gwn_ShaderInterface* shaderface = calloc(1, sizeof(Gwn_ShaderInterface)); shaderface->program = program; |