Blender
V3.3
source
blender
gpu
intern
gpu_shader_builder.cc
Go to the documentation of this file.
1
/* SPDX-License-Identifier: GPL-2.0-or-later
2
* Copyright 2021 Blender Foundation. All rights reserved. */
3
10
#include <iostream>
11
12
#include "
GHOST_C-api.h
"
13
14
#include "
GPU_context.h
"
15
#include "
GPU_init_exit.h
"
16
#include "
gpu_shader_create_info_private.hh
"
17
18
#include "
CLG_log.h
"
19
20
namespace
blender::gpu::shader_builder
{
21
22
class
ShaderBuilder
{
23
private
:
24
GHOST_SystemHandle ghost_system_;
25
GHOST_ContextHandle ghost_context_;
26
GPUContext
*gpu_context_ =
nullptr
;
27
28
public
:
29
void
init
();
30
bool
bake_create_infos
();
31
void
exit
();
32
};
33
34
bool
ShaderBuilder::bake_create_infos
()
35
{
36
return
gpu_shader_create_info_compile_all
();
37
}
38
39
void
ShaderBuilder::init
()
40
{
41
CLG_init
();
42
43
GHOST_GLSettings
glSettings = {0};
44
ghost_system_ =
GHOST_CreateSystem
();
45
ghost_context_ =
GHOST_CreateOpenGLContext
(ghost_system_, glSettings);
46
GHOST_ActivateOpenGLContext
(ghost_context_);
47
48
gpu_context_ =
GPU_context_create
(
nullptr
);
49
GPU_init
();
50
}
51
52
void
ShaderBuilder::exit
()
53
{
54
GPU_exit
();
55
56
GPU_context_discard
(gpu_context_);
57
58
GHOST_DisposeOpenGLContext
(ghost_system_, ghost_context_);
59
GHOST_DisposeSystem
(ghost_system_);
60
61
CLG_exit
();
62
}
63
64
}
// namespace blender::gpu::shader_builder
65
67
int
main
(
int
argc,
const
char
*argv[])
68
{
69
if
(argc < 2) {
70
printf(
"Usage: %s <data_file_to>\n"
, argv[0]);
71
exit(1);
72
}
73
74
int
exit_code = 0;
75
76
blender::gpu::shader_builder::ShaderBuilder
builder;
77
builder.
init
();
78
if
(!builder.
bake_create_infos
()) {
79
exit_code = 1;
80
}
81
builder.
exit
();
82
exit(exit_code);
83
84
return
exit_code;
85
}
CLG_log.h
CLG_exit
void CLG_exit(void)
Definition:
clog.c:703
CLG_init
void CLG_init(void)
Definition:
clog.c:696
GHOST_C-api.h
GHOST C-API function and type declarations.
GHOST_CreateSystem
GHOST_SystemHandle GHOST_CreateSystem(void)
Definition:
GHOST_C-api.cpp:25
GHOST_DisposeOpenGLContext
GHOST_TSuccess GHOST_DisposeOpenGLContext(GHOST_SystemHandle systemhandle, GHOST_ContextHandle contexthandle)
Definition:
GHOST_C-api.cpp:131
GHOST_ActivateOpenGLContext
GHOST_TSuccess GHOST_ActivateOpenGLContext(GHOST_ContextHandle contexthandle)
Definition:
GHOST_C-api.cpp:700
GHOST_CreateOpenGLContext
GHOST_ContextHandle GHOST_CreateOpenGLContext(GHOST_SystemHandle systemhandle, GHOST_GLSettings glSettings)
Definition:
GHOST_C-api.cpp:123
GHOST_DisposeSystem
GHOST_TSuccess GHOST_DisposeSystem(GHOST_SystemHandle systemhandle)
Definition:
GHOST_C-api.cpp:40
GPU_context.h
GPUContext
struct GPUContext GPUContext
Definition:
GPU_context.h:27
GPU_context_discard
void GPU_context_discard(GPUContext *)
Definition:
gpu_context.cc:110
GPU_context_create
GPUContext * GPU_context_create(void *ghost_window)
Definition:
gpu_context.cc:93
GPU_init_exit.h
GPU_init
void GPU_init(void)
Definition:
gpu_init_exit.c:24
GPU_exit
void GPU_exit(void)
Definition:
gpu_init_exit.c:45
blender::gpu::shader_builder::ShaderBuilder
Definition:
gpu_shader_builder.cc:22
blender::gpu::shader_builder::ShaderBuilder::init
void init()
Definition:
gpu_shader_builder.cc:39
blender::gpu::shader_builder::ShaderBuilder::exit
void exit()
Definition:
gpu_shader_builder.cc:52
blender::gpu::shader_builder::ShaderBuilder::bake_create_infos
bool bake_create_infos()
Definition:
gpu_shader_builder.cc:34
main
int main(int argc, const char *argv[])
Entry point for the shader_builder.
Definition:
gpu_shader_builder.cc:67
gpu_shader_create_info_compile_all
bool gpu_shader_create_info_compile_all()
Definition:
gpu_shader_create_info.cc:329
gpu_shader_create_info_private.hh
blender::gpu::shader_builder
Definition:
gpu_shader_builder.cc:20
GHOST_GLSettings
Definition:
GHOST_Types.h:57
Generated on Tue Oct 22 2024 13:18:25 for Blender by
doxygen
1.9.1