Welcome to mirror list, hosted at ThFree Co, Russian Federation.

common.h « gawain « gpu « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 90340b94e4dd5f1d0b5e3e955d106067d67b01e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58

// Gawain common #defines and #includes
//
// 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

// #define TRUST_NO_ONE !defined(NDEBUG)
#define TRUST_NO_ONE 1
// strict error checking, always enabled during early development

#include <GL/glew.h>
#include <stdbool.h>
#include <stdint.h>

#if TRUST_NO_ONE
  #include <assert.h>
#endif

#define PER_THREAD
// #define PER_THREAD __thread
// MSVC uses __declspec(thread) for C code

#define APPLE_LEGACY (defined(__APPLE__) && defined(WITH_GL_PROFILE_COMPAT))

#if APPLE_LEGACY
  #undef glGenVertexArrays
  #define glGenVertexArrays glGenVertexArraysAPPLE

  #undef glDeleteVertexArrays
  #define glDeleteVertexArrays glDeleteVertexArraysAPPLE

  #undef glBindVertexArray
  #define glBindVertexArray glBindVertexArrayAPPLE
#endif

typedef enum {
	PRIM_POINTS = GL_POINTS,
	PRIM_LINES = GL_LINES,
	PRIM_TRIANGLES = GL_TRIANGLES,

#ifdef WITH_GL_PROFILE_COMPAT
	PRIM_QUADS = GL_QUADS, // legacy GL has this, modern GL & Vulkan do not
#endif

	PRIM_LINE_STRIP = GL_LINE_STRIP,
	PRIM_LINE_LOOP = GL_LINE_LOOP, // GL has this, Vulkan does not
	PRIM_TRIANGLE_STRIP = GL_TRIANGLE_STRIP,
	PRIM_TRIANGLE_FAN = GL_TRIANGLE_FAN,

	PRIM_NONE = 0xF
} PrimitiveType;