[Bf-blender-cvs] [6329629bb9e] blender2.8: GWN: Port to GPU module: codestyle & licence

Clément Foucault noreply at git.blender.org
Wed Jul 18 11:50:31 CEST 2018


Commit: 6329629bb9eab86a989367a148154a7ebfa074df
Author: Clément Foucault
Date:   Tue Jul 17 14:46:44 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB6329629bb9eab86a989367a148154a7ebfa074df

GWN: Port to GPU module: codestyle & licence

===================================================================

M	intern/gawain/gawain/gwn_attr_binding.h
M	intern/gawain/gawain/gwn_attr_binding_private.h
M	intern/gawain/gawain/gwn_batch.h
M	intern/gawain/gawain/gwn_batch_private.h
M	intern/gawain/gawain/gwn_buffer_id.h
M	intern/gawain/gawain/gwn_common.h
M	intern/gawain/gawain/gwn_context.h
M	intern/gawain/gawain/gwn_element.h
M	intern/gawain/gawain/gwn_imm_util.h
M	intern/gawain/gawain/gwn_immediate.h
M	intern/gawain/gawain/gwn_primitive.h
M	intern/gawain/gawain/gwn_primitive_private.h
M	intern/gawain/gawain/gwn_shader_interface.h
M	intern/gawain/gawain/gwn_vertex_array_id.h
M	intern/gawain/gawain/gwn_vertex_buffer.h
M	intern/gawain/gawain/gwn_vertex_format.h
M	intern/gawain/gawain/gwn_vertex_format_private.h
M	intern/gawain/src/gwn_attr_binding.c
M	intern/gawain/src/gwn_batch.c
M	intern/gawain/src/gwn_buffer_id.cpp
M	intern/gawain/src/gwn_element.c
M	intern/gawain/src/gwn_imm_util.c
M	intern/gawain/src/gwn_immediate.c
M	intern/gawain/src/gwn_primitive.c
M	intern/gawain/src/gwn_shader_interface.c
M	intern/gawain/src/gwn_vertex_array_id.cpp
M	intern/gawain/src/gwn_vertex_buffer.c
M	intern/gawain/src/gwn_vertex_format.c

===================================================================

diff --git a/intern/gawain/gawain/gwn_attr_binding.h b/intern/gawain/gawain/gwn_attr_binding.h
index a209e1c4f0f..8030e86ea92 100644
--- a/intern/gawain/gawain/gwn_attr_binding.h
+++ b/intern/gawain/gawain/gwn_attr_binding.h
@@ -1,19 +1,42 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2016 by Mike Erwin.
+ * All rights reserved.
+ *
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
 
-// Gawain vertex attribute binding
-//
-// This code is part of the Gawain library, with modifications
-// specific to integration with Blender.
-//
-// Copyright 2016 Mike Erwin
-//
-// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of
-// the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
+/** \file blender/gpu/gwn_attr_binding.h
+ *  \ingroup gpu
+ *
+ * Gawain vertex attribute binding
+ */
 
-#pragma once
+#ifndef __GWN_ATTR_BINDING_H__
+#define __GWN_ATTR_BINDING_H__
 
 #include "gwn_common.h"
 
 typedef struct Gwn_AttrBinding {
-	uint64_t loc_bits; // store 4 bits for each of the 16 attribs
-	uint16_t enabled_bits; // 1 bit for each attrib
+	uint64_t loc_bits; /* store 4 bits for each of the 16 attribs */
+	uint16_t enabled_bits; /* 1 bit for each attrib */
 } Gwn_AttrBinding;
+
+#endif /* __GWN_ATTR_BINDING_H__ */
diff --git a/intern/gawain/gawain/gwn_attr_binding_private.h b/intern/gawain/gawain/gwn_attr_binding_private.h
index 300945d464b..cead1896ec7 100644
--- a/intern/gawain/gawain/gwn_attr_binding_private.h
+++ b/intern/gawain/gawain/gwn_attr_binding_private.h
@@ -1,15 +1,36 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2016 by Mike Erwin.
+ * All rights reserved.
+ *
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
 
-// Gawain vertex attribute binding
-//
-// This code is part of the Gawain library, with modifications
-// specific to integration with Blender.
-//
-// Copyright 2017 Mike Erwin
-//
-// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of
-// the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
+/** \file blender/gpu/gwn_attr_binding_private.h
+ *  \ingroup gpu
+ *
+ * Gawain vertex attribute binding
+ */
 
-#pragma once
+#ifndef __GWN_ATTR_BINDING_PRIVATE_H__
+#define __GWN_ATTR_BINDING_PRIVATE_H__
 
 #include "gwn_vertex_format.h"
 #include "gwn_shader_interface.h"
@@ -18,3 +39,5 @@ void AttribBinding_clear(Gwn_AttrBinding*);
 
 void get_attrib_locations(const Gwn_VertFormat*, Gwn_AttrBinding*, const Gwn_ShaderInterface*);
 unsigned read_attrib_location(const Gwn_AttrBinding*, unsigned a_idx);
+
+#endif /* __GWN_ATTR_BINDING_PRIVATE_H__ */
diff --git a/intern/gawain/gawain/gwn_batch.h b/intern/gawain/gawain/gwn_batch.h
index 734df3c91b6..a7a54502cc0 100644
--- a/intern/gawain/gawain/gwn_batch.h
+++ b/intern/gawain/gawain/gwn_batch.h
@@ -1,15 +1,37 @@
-
-// Gawain geometry batch
-//
-// This code is part of the Gawain library, with modifications
-// specific to integration with Blender.
-//
-// Copyright 2016 Mike Erwin
-//
-// This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of
-// the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
-
-#pragma once
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2016 by Mike Erwin.
+ * All rights reserved.
+ *
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/gpu/gwn_batch.h
+ *  \ingroup gpu
+ *
+ * Gawain geometry batch
+ * Contains VAOs + VBOs + Shader representing a drawable entity.
+ */
+
+#ifndef __GWN_BATCH_H__
+#define __GWN_BATCH_H__
 
 #include "gwn_vertex_buffer.h"
 #include "gwn_element.h"
@@ -27,43 +49,43 @@ typedef enum {
 #define GWN_BATCH_VAO_DYN_ALLOC_COUNT 16
 
 typedef struct Gwn_Batch {
-	// geometry
-	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
+	/* geometry */
+	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 */
 	uint32_t gl_prim_type;
 
-	// cached values (avoid dereferencing later)
+	/* cached values (avoid dereferencing later) */
 	uint32_t vao_id;
 	uint32_t program;
 	const struct Gwn_ShaderInterface* interface;
 
-	// book-keeping
-	unsigned owns_flag;
-	struct Gwn_Context *context; // used to free all vaos. this implies all vaos were created under the same context.
+	/* book-keeping */
+	uint owns_flag;
+	struct Gwn_Context *context; /* used to free all vaos. this implies all vaos were created under the same context. */
 	Gwn_BatchPhase phase;
 	bool program_in_use;
 
-	// Vao management: remembers all geometry state (vertex attrib bindings & element buffer)
-	// for each shader interface. Start with a static number of vaos and fallback to dynamic count
-	// if necessary. Once a batch goes dynamic it does not go back.
+	/* Vao management: remembers all geometry state (vertex attrib bindings & element buffer)
+	 * for each shader interface. Start with a static number of vaos and fallback to dynamic count
+	 * if necessary. Once a batch goes dynamic it does not go back. */
 	bool is_dynamic_vao_count;
 	union {
-		// Static handle count
+		/* Static handle count */
 		struct {
 			const struct Gwn_ShaderInterface* interfaces[GWN_BATCH_VAO_STATIC_LEN];
 			uint32_t vao_ids[GWN_BATCH_VAO_STATIC_LEN];
 		} static_vaos;
-		// Dynamic handle count
+		/* Dynamic handle count */
 		struct {
-			unsigned count;
+			uint count;
 			const struct Gwn_ShaderInterface** interfaces;
 			uint32_t* vao_ids;
 		} dynamic_vaos;
 	};
 
-	// XXX This is the only solution if we want to have some data structure using
-	// batches as key to identify nodes. We must destroy these nodes with this callback.
+	/* XXX This is the only solution if we want to have some data structure using
+	 * batches as key to identify nodes. We must destroy these nodes with this callback. */
 	void (*free_callback)(struct Gwn_Batch*, void*);
 	void* callback_data;
 } Gwn_Batch;
@@ -75,8 +97,8 @@ enum {
 	GWN_BATCH_OWNS_INDEX = (1 << 31),
 };
 
-Gwn_Batch* GWN_batch_create_ex(Gwn_PrimType, Gwn_VertBuf*, Gwn_IndexBuf*, unsigned owns_flag);
-void GWN_batch_init_ex(Gwn_Batch*, Gwn_PrimType, Gwn_VertBuf*, Gwn_IndexBuf*, unsigned owns_flag);
+Gwn_Batch* GWN_batch_create_ex(Gwn_PrimType, Gwn_VertBuf*, Gwn_IndexBuf*, uint owns_flag);
+void GWN_batch_init_ex(Gwn_Batch*, Gwn_PrimType, Gwn_VertBuf*, Gwn_IndexBuf*, uint owns_flag);
 Gwn_Batch* GWN_batch_duplicate(Gwn_Batch* batch_src);
 
 #define GWN_batch_create(prim, verts, elem) \
@@ -84,11 +106,11 @@ Gwn_Batch* GWN_batch_duplicate(Gwn_Batch* batch_src);
 #define GWN_batch_init(batch, prim, verts, elem) \
 	GWN_batch_init_ex(batch, prim, verts, elem, 0)
 
-void GWN_batch_discard(Gwn_Batch*); // verts & elem are not discarded
+void GWN_batch_discard(Gwn_Batch*); /* verts & elem are not discarded */
 
 void GWN_batch_callback_free_set(Gwn_Batch*, void (*callback)(Gwn_Batch*, void*), void*);
 
-void GWN_batch_instbuf_set(Gwn_Batch*, Gwn_VertBuf*, bool own_vbo); // Instancing
+void GWN_batch_instbuf_set(Gwn_Batch*, Gwn_VertBuf*, bool own_vbo); /* Instancing */
 
 int GWN_batch_vertbuf_add_ex(Gwn_Batch*, Gwn_VertBuf*, bool own_vbo);
 
@@ -97,10 +119,10 @@ int GWN_batch_vertbuf_add_ex(Gwn_Batch*, Gwn_VertBuf*, bool own_vbo);
 
 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

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list