ae2f_docs
Loading...
Searching...
No Matches
conf.h
Go to the documentation of this file.
1/** @file conf.h @brief bootstrap the compiler state machine */
2
3#include <util/emitx.h>
4#include <util/id.h>
5
6#include <aclspv.h>
7#include <aclspv/abi.h>
8
9#include <spirv/unified1/spirv.h>
10
11#define wrd_caps h_ctx->m_section.m_capability
12#define wrd_caps_count h_ctx->m_count.m_capability
13
14#define wrd_ext h_ctx->m_section.m_ext
15#define wrd_ext_count h_ctx->m_count.m_ext
16
17ae2f_inline static e_aclspv_compile_t impl_conf(
18 const h_util_ctx_t h_ctx
19 )
20{
21 aclspv_wrd_t POS = 0;
22
23 assert(h_ctx);
24 h_ctx->m_id = ID_DEFAULT_END;
25
26 h_ctx->m_count.m_capability = 0;
27 h_ctx->m_count.m_ext = 0;
28 h_ctx->m_count.m_memmodel = 0;
29 h_ctx->m_count.m_entp = 0;
30 h_ctx->m_count.m_execmode = 0;
31 h_ctx->m_count.m_name = 0;
32 h_ctx->m_count.m_decorate = 0;
33 h_ctx->m_count.m_types = 0;
34 h_ctx->m_count.m_vars = 0;
35 h_ctx->m_count.m_fndef = 0;
36
37 /*** Shader Capability **/
38
42 , SpvOpCapability
43 , SpvCapabilityShader))
44 return ACLSPV_COMPILE_ALLOC_FAILED;
45
46
47 h_ctx->m_is_for_gl = 1;
48 h_ctx->m_is_logical = 1;
53 , SpvOpCapability
54 , SpvCapabilityAddresses))
55 return ACLSPV_COMPILE_ALLOC_FAILED;
56 }
57
58 unless(h_ctx->m_is_for_gl) {
62 , SpvOpCapability
63 , SpvCapabilityVulkanMemoryModel))
64 return ACLSPV_COMPILE_ALLOC_FAILED;
65
66 POS = wrd_ext_count;
68 return ACLSPV_COMPILE_ALLOC_FAILED;
70 , "SPV_KHR_vulkan_memory_model"))
71 return ACLSPV_COMPILE_ALLOC_FAILED;
73 }
74
75 /*** Extension Default **/
76 POS = wrd_ext_count;
78 return ACLSPV_COMPILE_ALLOC_FAILED;
79 unless(wrd_ext_count = util_emit_str(&wrd_ext, wrd_ext_count, "SPV_KHR_storage_buffer_storage_class"))
80 return ACLSPV_COMPILE_ALLOC_FAILED;
82
83 /*** Memory Model **/
84 ae2f_expected_but_else(h_ctx->m_count.m_memmodel = util_emitx_3(
85 &h_ctx->m_section.m_memmodel
86 , 0, SpvOpMemoryModel
87 , h_ctx->m_is_logical
88 ? SpvAddressingModelLogical
89 : h_ctx->m_is_buffer_64 ? SpvAddressingModelPhysical64 : SpvAddressingModelPhysical32
90 , h_ctx->m_is_for_gl ? SpvMemoryModelGLSL450 : SpvMemoryModelVulkan))
91 return ACLSPV_COMPILE_ALLOC_FAILED;
92
93 return ACLSPV_COMPILE_OK;
94}
#define ae2f_IS_SHARED
Definition Call.auto.h:12
#define ae2f_OFF
Definition Call.auto.h:3
#define ae2f_WhenCXX(a)
Appears when the current language is C.
Definition Cxx.h:44
#define ae2f_WhenC(a)
Appears when the current language is C++.
Definition Cxx.h:38
#define unless(a)
Invokes when condition is false.
Definition Keys.h:34
#define ae2f_extern
Suggests the existence of external variable or function, in naming of C. [non-mangling].
Definition Keys.h:25
#define ae2f_NIL
Definition Nil.h:13
#define ACLSPV_ABI_DECL
Declaration as ABI.
Definition abi.h:23
#define STATE_VAL
#define FNINFO
#define cpysz
#define cpypad
#define ae2f_assume(a)
tells the compiler that value if a is false, below this keyword is not expected to be reached.
Definition cc.h:228
#define ae2f_unexpected_but_if(a)
Definition cc.h:192
#define ae2f_ccpure
Keyword as [[pure]] on C23.
Definition cc.h:52
#define ae2f_expected_but_else(a)
Definition cc.h:201
#define ae2f_expected_if(a)
Definition cc.h:195
#define ae2f_ccconst
Keyword as [[const]] on C23..
Definition cc.h:66
#define ae2f_noexcept
marker that this function does not throw something.
Definition cc.h:133
#define ae2f_restrict
Keyword as restrict on C99.
Definition cc.h:81
#define ae2f_expected_not(a)
expectes a as false.
Definition cc.h:185
#define ae2f_unreachable()
tells the compiler that below this keyword is not expected to be reached.
Definition cc.h:213
#define ae2f_inline
inline
Definition cc.h:149
#define ae2f_expected(a)
expectes a as true.
Definition cc.h:184
#define wrd_caps
Definition conf.h:11
#define wrd_caps_count
Definition conf.h:12
#define wrd_ext
Definition conf.h:14
#define wrd_ext_count
Definition conf.h:15
#define CTX
#define EMIT_POS
#define util_emitx_type_pointer(h_wrds, c_wrdcount, c_retid, c_storage_class, c_elm_type_id)
Definition emitx.h:134
#define ret_count
#define get_buf_from_scale(h_alloc, c_scale)
Definition scale.h:34
#define aclspv_opcode_t
integer as operation code
Definition spvty.h:27
aclspv_wrd_t aclspv_wrdcount_t
the integer type represents the number of word.
Definition spvty.h:61
#define ACLSPV_MASK_OPCODE
mask for opcode
Definition spvty.h:37
#define aclspv_wrd_t
integer as word
Definition spvty.h:16
#define ACLSPV_MASK_NOPRNDS
mask for number of operands
Definition spvty.h:42
x_aclspv_vec m_scale_vars
Definition ctx.h:62
aclspv_wrdcount_t m_num_type_uniques
Definition ctx.h:44
x_aclspv_vec m_cursors
cache for cursors for parsing one function for its use see util/cursor.h
Definition ctx.h:77
x_aclspv_vec m_constant_cache
Definition ctx.h:65
aclspv_id_t m_id
id
Definition ctx.h:50
x_aclspv_vec m_ret
word count for m_ret
Definition ctx.h:56
aclspv_wrd_t m_is_logical
when on, ignores m_is_buffer_64.
Definition ctx.h:23
aclspv_wrdcount_t m_num_cursor
number of m_cursors. for its use see util/cursor.h
Definition ctx.h:41
x_aclspv_vec m_type_uniques
cache for complex types which needs to be stored somewhere for its use see util/type_unique....
Definition ctx.h:86
util_bind_unified m_unified
Definition bind.h:20
#define mk_noprnds(c_num_opprm)
Definition wrdemit.h:66
#define emit_opcode(h_wrds, c_wrdcount, c_opcode, c_num_opprm_opt)
try emit opcode with num_opprm
Definition wrdemit.h:75
#define sz_to_count(c_sz)
byte size to word count
Definition wrdemit.h:24
#define get_wrd_of_vec(vec)
get word buffer from vector
Definition wrdemit.h:38
aclspv_wrdcount_t spvsz_t
Definition wrdemit.h:18
#define count_to_sz(c_count)
word count to byte size
Definition wrdemit.h:32
#define set_oprnd_count_for_opcode(cr_wrd, c_num_opprm)
Definition wrdemit.h:78
#define opcode_to_wrd(c_opcode, c_num_opprm)
Definition wrdemit.h:69