| 1 | /** |
| 2 | * MojoShader; generate shader programs from bytecode of compiled |
| 3 | * Direct3D shaders. |
| 4 | * |
| 5 | * Please see the file LICENSE.txt in the source's root directory. |
| 6 | * |
| 7 | * This file written by Ryan C. Gordon. |
| 8 | */ |
| 9 | |
| 10 | #ifndef MOJOSHADER_PROFILE_H |
| 11 | #define MOJOSHADER_PROFILE_Hcxx . . $ `profiles/mojoshader_profile.h:11:9`! |
| 12 | |
| 13 | #include "../mojoshader_internal.h"cxx . . $ `<file>/mojoshader_internal.h`/ |
| 14 | |
| 15 | #if SUPPORT_PROFILE_SPIRVcxx . . $ `mojoshader_internal.h:210:9`! |
| 16 | #include "mojoshader_profile_spirv.h"cxx . . $ `<file>/profiles/mojoshader_profile_spirv.h`/ |
| 17 | #endif |
| 18 | |
| 19 | typedef struct ConstantsListcxx . . $ ConstantsList# |
| 20 | { |
| 21 | MOJOSHADER_constantcxx . . $ MOJOSHADER_constant# constantcxx . . $ ConstantsList#constant.; |
| 22 | struct ConstantsListcxx . . $ ConstantsList# *nextcxx . . $ ConstantsList#next.; |
| 23 | } ConstantsListcxx . . $ ConstantsList#; |
| 24 | |
| 25 | typedef struct VariableListcxx . . $ VariableList# |
| 26 | { |
| 27 | MOJOSHADER_uniformTypecxx . . $ MOJOSHADER_uniformType# typecxx . . $ VariableList#type.; |
| 28 | int indexcxx . . $ VariableList#index.; |
| 29 | int countcxx . . $ VariableList#count.; |
| 30 | ConstantsListcxx . . $ ConstantsList# *constantcxx . . $ VariableList#constant.; |
| 31 | int usedcxx . . $ VariableList#used.; |
| 32 | int emit_positioncxx . . $ VariableList#emit_position.; // used in some profiles. |
| 33 | struct VariableListcxx . . $ VariableList# *nextcxx . . $ VariableList#next.; |
| 34 | } VariableListcxx . . $ VariableList#; |
| 35 | |
| 36 | typedef struct RegisterListcxx . . $ RegisterList# |
| 37 | { |
| 38 | RegisterTypecxx . . $ RegisterType# regtypecxx . . $ RegisterList#regtype.; |
| 39 | int regnumcxx . . $ RegisterList#regnum.; |
| 40 | MOJOSHADER_usagecxx . . $ MOJOSHADER_usage# usagecxx . . $ RegisterList#usage.; |
| 41 | unsigned int indexcxx . . $ RegisterList#index.; |
| 42 | int writemaskcxx . . $ RegisterList#writemask.; |
| 43 | int misccxx . . $ RegisterList#misc.; |
| 44 | int writtencxx . . $ RegisterList#written.; |
| 45 | #if SUPPORT_PROFILE_SPIRVcxx . . $ `mojoshader_internal.h:210:9`! |
| 46 | structcxx . . $ RegisterList#$anonymous_type_0# { |
| 47 | uint32cxx . . $ uint32# iddeclcxx . . $ RegisterList#$anonymous_type_0#iddecl.; |
| 48 | int is_ssacxx . . $ RegisterList#$anonymous_type_0#is_ssa.; // FIXME(krolli): Is there an existing way to tell constants and uniforms apart? |
| 49 | } spirvcxx . . $ RegisterList#spirv.; |
| 50 | #endif |
| 51 | const VariableListcxx . . $ VariableList# *arraycxx . . $ RegisterList#array.; |
| 52 | struct RegisterListcxx . . $ RegisterList# *nextcxx . . $ RegisterList#next.; |
| 53 | } RegisterListcxx . . $ RegisterList#; |
| 54 | |
| 55 | typedef structcxx . . $ $anonymous_type_3d78d65a03e818ad_1# |
| 56 | { |
| 57 | const uint32cxx . . $ uint32# *tokencxx . . $ $anonymous_type_3d78d65a03e818ad_1#token.; // this is the unmolested token in the stream. |
| 58 | int regnumcxx . . $ $anonymous_type_3d78d65a03e818ad_1#regnum.; |
| 59 | int swizzlecxx . . $ $anonymous_type_3d78d65a03e818ad_1#swizzle.; // xyzw (all four, not split out). |
| 60 | int swizzle_xcxx . . $ $anonymous_type_3d78d65a03e818ad_1#swizzle_x.; |
| 61 | int swizzle_ycxx . . $ $anonymous_type_3d78d65a03e818ad_1#swizzle_y.; |
| 62 | int swizzle_zcxx . . $ $anonymous_type_3d78d65a03e818ad_1#swizzle_z.; |
| 63 | int swizzle_wcxx . . $ $anonymous_type_3d78d65a03e818ad_1#swizzle_w.; |
| 64 | SourceModcxx . . $ SourceMod# src_modcxx . . $ $anonymous_type_3d78d65a03e818ad_1#src_mod.; |
| 65 | RegisterTypecxx . . $ RegisterType# regtypecxx . . $ $anonymous_type_3d78d65a03e818ad_1#regtype.; |
| 66 | int relativecxx . . $ $anonymous_type_3d78d65a03e818ad_1#relative.; |
| 67 | RegisterTypecxx . . $ RegisterType# relative_regtypecxx . . $ $anonymous_type_3d78d65a03e818ad_1#relative_regtype.; |
| 68 | int relative_regnumcxx . . $ $anonymous_type_3d78d65a03e818ad_1#relative_regnum.; |
| 69 | int relative_componentcxx . . $ $anonymous_type_3d78d65a03e818ad_1#relative_component.; |
| 70 | const VariableListcxx . . $ VariableList# *relative_arraycxx . . $ $anonymous_type_3d78d65a03e818ad_1#relative_array.; |
| 71 | } SourceArgInfocxx . . $ SourceArgInfo#; |
| 72 | |
| 73 | struct Profilecxx . . $ Profile#; // predeclare. |
| 74 | |
| 75 | typedef struct CtabDatacxx . . $ CtabData# |
| 76 | { |
| 77 | int have_ctabcxx . . $ CtabData#have_ctab.; |
| 78 | int symbol_countcxx . . $ CtabData#symbol_count.; |
| 79 | MOJOSHADER_symbolcxx . . $ MOJOSHADER_symbol# *symbolscxx . . $ CtabData#symbols.; |
| 80 | } CtabDatacxx . . $ CtabData#; |
| 81 | |
| 82 | // Context...this is state that changes as we parse through a shader... |
| 83 | typedef struct Contextcxx . . $ Context# |
| 84 | { |
| 85 | int isfailcxx . . $ Context#isfail.; |
| 86 | int out_of_memorycxx . . $ Context#out_of_memory.; |
| 87 | MOJOSHADER_malloccxx . . $ MOJOSHADER_malloc# malloccxx . . $ Context#malloc.; |
| 88 | MOJOSHADER_freecxx . . $ MOJOSHADER_free# freecxx . . $ Context#free.; |
| 89 | void *malloc_datacxx . . $ Context#malloc_data.; |
| 90 | int current_positioncxx . . $ Context#current_position.; |
| 91 | const uint32cxx . . $ uint32# *orig_tokenscxx . . $ Context#orig_tokens.; |
| 92 | const uint32cxx . . $ uint32# *tokenscxx . . $ Context#tokens.; |
| 93 | uint32cxx . . $ uint32# tokencountcxx . . $ Context#tokencount.; |
| 94 | int know_shader_sizecxx . . $ Context#know_shader_size.; |
| 95 | const MOJOSHADER_swizzlecxx . . $ MOJOSHADER_swizzle# *swizzlescxx . . $ Context#swizzles.; |
| 96 | unsigned int swizzles_countcxx . . $ Context#swizzles_count.; |
| 97 | const MOJOSHADER_samplerMapcxx . . $ MOJOSHADER_samplerMap# *samplermapcxx . . $ Context#samplermap.; |
| 98 | unsigned int samplermap_countcxx . . $ Context#samplermap_count.; |
| 99 | Buffercxx . . $ Buffer# *outputcxx . . $ Context#output.; |
| 100 | Buffercxx . . $ Buffer# *preflightcxx . . $ Context#preflight.; |
| 101 | Buffercxx . . $ Buffer# *globalscxx . . $ Context#globals.; |
| 102 | Buffercxx . . $ Buffer# *inputscxx . . $ Context#inputs.; |
| 103 | Buffercxx . . $ Buffer# *outputscxx . . $ Context#outputs.; |
| 104 | Buffercxx . . $ Buffer# *helperscxx . . $ Context#helpers.; |
| 105 | Buffercxx . . $ Buffer# *subroutinescxx . . $ Context#subroutines.; |
| 106 | Buffercxx . . $ Buffer# *mainline_introcxx . . $ Context#mainline_intro.; |
| 107 | Buffercxx . . $ Buffer# *mainline_argumentscxx . . $ Context#mainline_arguments.; |
| 108 | Buffercxx . . $ Buffer# *mainline_topcxx . . $ Context#mainline_top.; |
| 109 | Buffercxx . . $ Buffer# *mainlinecxx . . $ Context#mainline.; |
| 110 | Buffercxx . . $ Buffer# *postflightcxx . . $ Context#postflight.; |
| 111 | Buffercxx . . $ Buffer# *ignorecxx . . $ Context#ignore.; |
| 112 | Buffercxx . . $ Buffer# *output_stackcxx . . $ Context#output_stack.[3]; |
| 113 | int indent_stackcxx . . $ Context#indent_stack.[3]; |
| 114 | int output_stack_lencxx . . $ Context#output_stack_len.; |
| 115 | int indentcxx . . $ Context#indent.; |
| 116 | const char *shader_type_strcxx . . $ Context#shader_type_str.; |
| 117 | const char *endlinecxx . . $ Context#endline.; |
| 118 | const char *mainfncxx . . $ Context#mainfn.; |
| 119 | int endline_lencxx . . $ Context#endline_len.; |
| 120 | int profileidcxx . . $ Context#profileid.; |
| 121 | const struct Profilecxx . . $ Profile# *profilecxx . . $ Context#profile.; |
| 122 | MOJOSHADER_shaderTypecxx . . $ MOJOSHADER_shaderType# shader_typecxx . . $ Context#shader_type.; |
| 123 | uint8cxx . . $ uint8# major_vercxx . . $ Context#major_ver.; |
| 124 | uint8cxx . . $ uint8# minor_vercxx . . $ Context#minor_ver.; |
| 125 | DestArgInfocxx . . $ DestArgInfo# dest_argcxx . . $ Context#dest_arg.; |
| 126 | SourceArgInfocxx . . $ SourceArgInfo# source_argscxx . . $ Context#source_args.[5]; |
| 127 | SourceArgInfocxx . . $ SourceArgInfo# predicate_argcxx . . $ Context#predicate_arg.; // for predicated instructions. |
| 128 | uint32cxx . . $ uint32# dwordscxx . . $ Context#dwords.[4]; |
| 129 | uint32cxx . . $ uint32# version_tokencxx . . $ Context#version_token.; |
| 130 | int instruction_countcxx . . $ Context#instruction_count.; |
| 131 | uint32cxx . . $ uint32# instruction_controlscxx . . $ Context#instruction_controls.; |
| 132 | uint32cxx . . $ uint32# previous_opcodecxx . . $ Context#previous_opcode.; |
| 133 | int coissuecxx . . $ Context#coissue.; |
| 134 | int loopscxx . . $ Context#loops.; |
| 135 | int repscxx . . $ Context#reps.; |
| 136 | int max_repscxx . . $ Context#max_reps.; |
| 137 | int cmpscxx . . $ Context#cmps.; |
| 138 | int scratch_registerscxx . . $ Context#scratch_registers.; |
| 139 | int max_scratch_registerscxx . . $ Context#max_scratch_registers.; |
| 140 | int branch_labels_stack_indexcxx . . $ Context#branch_labels_stack_index.; |
| 141 | int branch_labels_stackcxx . . $ Context#branch_labels_stack.[32]; |
| 142 | int assigned_branch_labelscxx . . $ Context#assigned_branch_labels.; |
| 143 | int assigned_vertex_attributescxx . . $ Context#assigned_vertex_attributes.; |
| 144 | int last_address_reg_componentcxx . . $ Context#last_address_reg_component.; |
| 145 | RegisterListcxx . . $ RegisterList# used_registerscxx . . $ Context#used_registers.; |
| 146 | RegisterListcxx . . $ RegisterList# defined_registerscxx . . $ Context#defined_registers.; |
| 147 | ErrorListcxx . . $ ErrorList# *errorscxx . . $ Context#errors.; |
| 148 | int constant_countcxx . . $ Context#constant_count.; |
| 149 | ConstantsListcxx . . $ ConstantsList# *constantscxx . . $ Context#constants.; |
| 150 | int uniform_countcxx . . $ Context#uniform_count.; |
| 151 | int uniform_float4_countcxx . . $ Context#uniform_float4_count.; |
| 152 | int uniform_int4_countcxx . . $ Context#uniform_int4_count.; |
| 153 | int uniform_bool_countcxx . . $ Context#uniform_bool_count.; |
| 154 | RegisterListcxx . . $ RegisterList# uniformscxx . . $ Context#uniforms.; |
| 155 | int attribute_countcxx . . $ Context#attribute_count.; |
| 156 | RegisterListcxx . . $ RegisterList# attributescxx . . $ Context#attributes.; |
| 157 | int sampler_countcxx . . $ Context#sampler_count.; |
| 158 | RegisterListcxx . . $ RegisterList# samplerscxx . . $ Context#samplers.; |
| 159 | VariableListcxx . . $ VariableList# *variablescxx . . $ Context#variables.; // variables to register mapping. |
| 160 | int centroid_allowedcxx . . $ Context#centroid_allowed.; |
| 161 | CtabDatacxx . . $ CtabData# ctabcxx . . $ Context#ctab.; |
| 162 | int have_relative_input_registerscxx . . $ Context#have_relative_input_registers.; |
| 163 | int have_multi_color_outputscxx . . $ Context#have_multi_color_outputs.; |
| 164 | int determined_constants_arrayscxx . . $ Context#determined_constants_arrays.; |
| 165 | int predicatedcxx . . $ Context#predicated.; |
| 166 | int uses_pointsizecxx . . $ Context#uses_pointsize.; |
| 167 | int uses_fogcxx . . $ Context#uses_fog.; |
| 168 | int need_max_floatcxx . . $ Context#need_max_float.; |
| 169 | |
| 170 | // !!! FIXME: move these into SUPPORT_PROFILE sections. |
| 171 | int glsl_generated_lit_helpercxx . . $ Context#glsl_generated_lit_helper.; |
| 172 | int glsl_generated_texlod_setupcxx . . $ Context#glsl_generated_texlod_setup.; |
| 173 | int glsl_generated_texm3x3spec_helpercxx . . $ Context#glsl_generated_texm3x3spec_helper.; |
| 174 | int arb1_wrote_positioncxx . . $ Context#arb1_wrote_position.; |
| 175 | // !!! FIXME: move these into SUPPORT_PROFILE sections. |
| 176 | |
| 177 | int have_preshadercxx . . $ Context#have_preshader.; |
| 178 | int ignores_ctabcxx . . $ Context#ignores_ctab.; |
| 179 | int reset_texmpadcxx . . $ Context#reset_texmpad.; |
| 180 | int texm3x2pad_dst0cxx . . $ Context#texm3x2pad_dst0.; |
| 181 | int texm3x2pad_src0cxx . . $ Context#texm3x2pad_src0.; |
| 182 | int texm3x3pad_dst0cxx . . $ Context#texm3x3pad_dst0.; |
| 183 | int texm3x3pad_src0cxx . . $ Context#texm3x3pad_src0.; |
| 184 | int texm3x3pad_dst1cxx . . $ Context#texm3x3pad_dst1.; |
| 185 | int texm3x3pad_src1cxx . . $ Context#texm3x3pad_src1.; |
| 186 | MOJOSHADER_preshadercxx . . $ MOJOSHADER_preshader# *preshadercxx . . $ Context#preshader.; |
| 187 | |
| 188 | #if SUPPORT_PROFILE_ARB1_NVcxx . . $ `mojoshader_internal.h:202:9`! |
| 189 | int profile_supports_nv2cxx . . $ Context#profile_supports_nv2.; |
| 190 | int profile_supports_nv3cxx . . $ Context#profile_supports_nv3.; |
| 191 | int profile_supports_nv4cxx . . $ Context#profile_supports_nv4.; |
| 192 | #endif |
| 193 | #if SUPPORT_PROFILE_GLSL120cxx . . $ `mojoshader_internal.h:186:9`! |
| 194 | int profile_supports_glsl120cxx . . $ Context#profile_supports_glsl120.; |
| 195 | #endif |
| 196 | #if SUPPORT_PROFILE_GLSLEScxx . . $ `mojoshader_internal.h:190:9`! |
| 197 | int profile_supports_glslescxx . . $ Context#profile_supports_glsles.; |
| 198 | #endif |
| 199 | #if SUPPORT_PROFILE_GLSLES3cxx . . $ `<built-in>:412:9`! |
| 200 | int profile_supports_glsles3; |
| 201 | #endif |
| 202 | |
| 203 | #if SUPPORT_PROFILE_METALcxx . . $ `<built-in>:414:9`! |
| 204 | int metal_need_header_common; |
| 205 | int metal_need_header_math; |
| 206 | int metal_need_header_relational; |
| 207 | int metal_need_header_geometric; |
| 208 | int metal_need_header_graphics; |
| 209 | int metal_need_header_texture; |
| 210 | #endif |
| 211 | |
| 212 | #if SUPPORT_PROFILE_SPIRVcxx . . $ `mojoshader_internal.h:210:9`! |
| 213 | int branch_labels_patch_stackcxx . . $ Context#branch_labels_patch_stack.[32]; |
| 214 | SpirvContextcxx . . $ SpirvContext# spirvcxx . . $ Context#spirv.; |
| 215 | #endif |
| 216 | #if SUPPORT_PROFILE_GLSPIRVcxx . . $ `mojoshader_internal.h:214:9`! |
| 217 | int profile_supports_glspirvcxx . . $ Context#profile_supports_glspirv.; |
| 218 | #endif |
| 219 | |
| 220 | #if SUPPORT_PROFILE_HLSLcxx . . $ `<built-in>:413:9`! |
| 221 | char hlsl_outpos_name[16]; |
| 222 | #endif |
| 223 | } Contextcxx . . $ Context#; |
| 224 | |
| 225 | // Use these macros so we can remove all bits of these profiles from the build. |
| 226 | #if SUPPORT_PROFILE_ARB1_NVcxx . . $ `mojoshader_internal.h:202:9`! |
| 227 | #define support_nv2cxx . . $ `profiles/mojoshader_profile.h:227:9`!(ctx) ((ctx)->profile_supports_nv2) |
| 228 | #define support_nv3cxx . . $ `profiles/mojoshader_profile.h:228:9`!(ctx) ((ctx)->profile_supports_nv3) |
| 229 | #define support_nv4cxx . . $ `profiles/mojoshader_profile.h:229:9`!(ctx) ((ctx)->profile_supports_nv4) |
| 230 | #else |
| 231 | #define support_nv2(ctx) (0) |
| 232 | #define support_nv3(ctx) (0) |
| 233 | #define support_nv4(ctx) (0) |
| 234 | #endif |
| 235 | |
| 236 | #if SUPPORT_PROFILE_GLSL120cxx . . $ `mojoshader_internal.h:186:9`! |
| 237 | #define support_glsl120cxx . . $ `profiles/mojoshader_profile.h:237:9`!(ctx) ((ctx)->profile_supports_glsl120) |
| 238 | #else |
| 239 | #define support_glsl120(ctx) (0) |
| 240 | #endif |
| 241 | |
| 242 | #if SUPPORT_PROFILE_GLSLES3cxx . . $ `<built-in>:412:9`! |
| 243 | #define support_glsles3(ctx) ((ctx)->profile_supports_glsles3) |
| 244 | #else |
| 245 | #define support_glsles3cxx . . $ `profiles/mojoshader_profile.h:245:9`!(ctx) (0) |
| 246 | #endif |
| 247 | |
| 248 | #if SUPPORT_PROFILE_GLSLEScxx . . $ `mojoshader_internal.h:190:9`! |
| 249 | #define support_glslescxx . . $ `profiles/mojoshader_profile.h:249:9`!(ctx) ((ctx)->profile_supports_glsles || support_glsles3(ctx)) |
| 250 | #else |
| 251 | #define support_glsles(ctx) (0) |
| 252 | #endif |
| 253 | |
| 254 | // Profile entry points... |
| 255 | |
| 256 | // one emit function for each opcode in each profile. |
| 257 | typedef void (*emit_functioncxx . . $ emit_function#)(Contextcxx . . $ Context# *ctx); |
| 258 | |
| 259 | // one emit function for starting output in each profile. |
| 260 | typedef void (*emit_startcxx . . $ emit_start#)(Contextcxx . . $ Context# *ctx, const char *profilestr); |
| 261 | |
| 262 | // one emit function for ending output in each profile. |
| 263 | typedef void (*emit_endcxx . . $ emit_end#)(Contextcxx . . $ Context# *ctx); |
| 264 | |
| 265 | // one emit function for phase opcode output in each profile. |
| 266 | typedef void (*emit_phasecxx . . $ emit_phase#)(Contextcxx . . $ Context# *ctx); |
| 267 | |
| 268 | // one emit function for finalizing output in each profile. |
| 269 | typedef void (*emit_finalizecxx . . $ emit_finalize#)(Contextcxx . . $ Context# *ctx); |
| 270 | |
| 271 | // one emit function for global definitions in each profile. |
| 272 | typedef void (*emit_globalcxx . . $ emit_global#)(Contextcxx . . $ Context# *ctx, RegisterTypecxx . . $ RegisterType# regtype, int regnum); |
| 273 | |
| 274 | // one emit function for relative uniform arrays in each profile. |
| 275 | typedef void (*emit_arraycxx . . $ emit_array#)(Contextcxx . . $ Context# *ctx, VariableListcxx . . $ VariableList# *var); |
| 276 | |
| 277 | // one emit function for relative constants arrays in each profile. |
| 278 | typedef void (*emit_const_arraycxx . . $ emit_const_array#)(Contextcxx . . $ Context# *ctx, |
| 279 | const struct ConstantsListcxx . . $ ConstantsList# *constslist, |
| 280 | int base, int size); |
| 281 | |
| 282 | // one emit function for uniforms in each profile. |
| 283 | typedef void (*emit_uniformcxx . . $ emit_uniform#)(Contextcxx . . $ Context# *ctx, RegisterTypecxx . . $ RegisterType# regtype, int regnum, |
| 284 | const VariableListcxx . . $ VariableList# *var); |
| 285 | |
| 286 | // one emit function for samplers in each profile. |
| 287 | typedef void (*emit_samplercxx . . $ emit_sampler#)(Contextcxx . . $ Context# *ctx, int stage, TextureTypecxx . . $ TextureType# ttype, |
| 288 | int texbem); |
| 289 | |
| 290 | // one emit function for attributes in each profile. |
| 291 | typedef void (*emit_attributecxx . . $ emit_attribute#)(Contextcxx . . $ Context# *ctx, RegisterTypecxx . . $ RegisterType# regtype, int regnum, |
| 292 | MOJOSHADER_usagecxx . . $ MOJOSHADER_usage# usage, int index, int wmask, |
| 293 | int flags); |
| 294 | |
| 295 | // one args function for each possible sequence of opcode arguments. |
| 296 | typedef int (*args_functioncxx . . $ args_function#)(Contextcxx . . $ Context# *ctx); |
| 297 | |
| 298 | // one state function for each opcode where we have state machine updates. |
| 299 | typedef void (*state_functioncxx . . $ state_function#)(Contextcxx . . $ Context# *ctx); |
| 300 | |
| 301 | // one function for varnames in each profile. |
| 302 | typedef const char *(*varname_functioncxx . . $ varname_function#)(Contextcxx . . $ Context# *c, RegisterTypecxx . . $ RegisterType# t, int num); |
| 303 | |
| 304 | // one function for const var array in each profile. |
| 305 | typedef const char *(*const_array_varname_functioncxx . . $ const_array_varname_function#)(Contextcxx . . $ Context# *c, int base, int size); |
| 306 | |
| 307 | typedef struct Profilecxx . . $ Profile# |
| 308 | { |
| 309 | const char *namecxx . . $ Profile#name.; |
| 310 | emit_startcxx . . $ emit_start# start_emittercxx . . $ Profile#start_emitter.; |
| 311 | emit_endcxx . . $ emit_end# end_emittercxx . . $ Profile#end_emitter.; |
| 312 | emit_phasecxx . . $ emit_phase# phase_emittercxx . . $ Profile#phase_emitter.; |
| 313 | emit_globalcxx . . $ emit_global# global_emittercxx . . $ Profile#global_emitter.; |
| 314 | emit_arraycxx . . $ emit_array# array_emittercxx . . $ Profile#array_emitter.; |
| 315 | emit_const_arraycxx . . $ emit_const_array# const_array_emittercxx . . $ Profile#const_array_emitter.; |
| 316 | emit_uniformcxx . . $ emit_uniform# uniform_emittercxx . . $ Profile#uniform_emitter.; |
| 317 | emit_samplercxx . . $ emit_sampler# sampler_emittercxx . . $ Profile#sampler_emitter.; |
| 318 | emit_attributecxx . . $ emit_attribute# attribute_emittercxx . . $ Profile#attribute_emitter.; |
| 319 | emit_finalizecxx . . $ emit_finalize# finalize_emittercxx . . $ Profile#finalize_emitter.; |
| 320 | varname_functioncxx . . $ varname_function# get_varnamecxx . . $ Profile#get_varname.; |
| 321 | const_array_varname_functioncxx . . $ const_array_varname_function# get_const_array_varnamecxx . . $ Profile#get_const_array_varname.; |
| 322 | } Profilecxx . . $ Profile#; |
| 323 | |
| 324 | // Common utilities... |
| 325 | |
| 326 | void out_of_memorycxx . . $ out_of_memory(612dd59919e2530e).(Contextcxx . . $ Context# *ctx); |
| 327 | void *Malloccxx . . $ Malloc(a6ec60c25fe5143e).(Contextcxx . . $ Context# *ctx, const size_t len); |
| 328 | char *StrDupcxx . . $ StrDup(5771b401aae6b992).(Contextcxx . . $ Context# *ctx, const char *str); |
| 329 | void Freecxx . . $ Free(b86e3b3d45e44ecf).(Contextcxx . . $ Context# *ctx, void *ptr); |
| 330 | void * MOJOSHADERCALLcxx . . $ `mojoshader.h:42:9`! MallocBridgecxx . . $ MallocBridge(d0e8a54466770ee5).(int bytes, void *data); |
| 331 | void MOJOSHADERCALLcxx . . $ `mojoshader.h:42:9`! FreeBridgecxx . . $ FreeBridge(6c58c5e2437d25a2).(void *ptr, void *data); |
| 332 | |
| 333 | int set_outputcxx . . $ set_output(dbab56076057d0b7).(Contextcxx . . $ Context# *ctx, Buffercxx . . $ Buffer# **section); |
| 334 | void push_outputcxx . . $ push_output(80f724ef23dce062).(Contextcxx . . $ Context# *ctx, Buffercxx . . $ Buffer# **section); |
| 335 | void pop_outputcxx . . $ pop_output(612dd59919e2530e).(Contextcxx . . $ Context# *ctx); |
| 336 | |
| 337 | uint32cxx . . $ uint32# ver_ui32cxx . . $ ver_ui32(ce7b340bf7a3914f).(const uint8cxx . . $ uint8# major, const uint8cxx . . $ uint8# minor); |
| 338 | int shader_version_supportedcxx . . $ shader_version_supported(d6776848f30c113d).(const uint8cxx . . $ uint8# maj, const uint8cxx . . $ uint8# min); |
| 339 | int shader_version_atleastcxx . . $ shader_version_atleast(83a707663ee9af3d).(const Contextcxx . . $ Context# *ctx, const uint8cxx . . $ uint8# maj, |
| 340 | const uint8cxx . . $ uint8# min); |
| 341 | int shader_version_exactlycxx . . $ shader_version_exactly(83a707663ee9af3d).(const Contextcxx . . $ Context# *ctx, const uint8cxx . . $ uint8# maj, |
| 342 | const uint8cxx . . $ uint8# min); |
| 343 | int shader_is_pixelcxx . . $ shader_is_pixel(73332d3452342b36).(const Contextcxx . . $ Context# *ctx); |
| 344 | int shader_is_vertexcxx . . $ shader_is_vertex(73332d3452342b36).(const Contextcxx . . $ Context# *ctx); |
| 345 | |
| 346 | int isfailcxx . . $ isfail(73332d3452342b36).(const Contextcxx . . $ Context# *ctx); |
| 347 | void failfcxx . . $ failf(f93f6dc5e2b298a0).(Contextcxx . . $ Context# *ctx, const char *fmt, ...); |
| 348 | void failcxx . . $ fail(72ff1ec6cf40f147).(Contextcxx . . $ Context# *ctx, const char *reason); |
| 349 | |
| 350 | void output_linecxx . . $ output_line(f93f6dc5e2b298a0).(Contextcxx . . $ Context# *ctx, const char *fmt, ...); |
| 351 | void output_blank_linecxx . . $ output_blank_line(612dd59919e2530e).(Contextcxx . . $ Context# *ctx); |
| 352 | |
| 353 | void floatstrcxx . . $ floatstr(c547f24a0ba6b59c).(Contextcxx . . $ Context# *ctx, char *buf, size_t bufsize, float f, |
| 354 | int leavedecimal); |
| 355 | |
| 356 | RegisterListcxx . . $ RegisterList# *reglist_insertcxx . . $ reglist_insert(ecaaee1ec12f4c21).(Contextcxx . . $ Context# *ctx, RegisterListcxx . . $ RegisterList# *prev, |
| 357 | const RegisterTypecxx . . $ RegisterType# regtype, |
| 358 | const int regnum); |
| 359 | RegisterListcxx . . $ RegisterList# *reglist_findcxx . . $ reglist_find(1623ad9ca4ff0177).(const RegisterListcxx . . $ RegisterList# *prev, |
| 360 | const RegisterTypecxx . . $ RegisterType# rtype, |
| 361 | const int regnum); |
| 362 | RegisterListcxx . . $ RegisterList# *set_used_registercxx . . $ set_used_register(e54d43264d6a4c0d).(Contextcxx . . $ Context# *ctx, |
| 363 | const RegisterTypecxx . . $ RegisterType# regtype, |
| 364 | const int regnum, |
| 365 | const int written); |
| 366 | void set_defined_registercxx . . $ set_defined_register(8475323e8d0fe52d).(Contextcxx . . $ Context# *ctx, const RegisterTypecxx . . $ RegisterType# rtype, |
| 367 | const int regnum); |
| 368 | |
| 369 | int writemask_xyzwcxx . . $ writemask_xyzw(7864480464b09eea).(const int writemask); |
| 370 | int writemask_xyzcxx . . $ writemask_xyz(7864480464b09eea).(const int writemask); |
| 371 | int writemask_xycxx . . $ writemask_xy(7864480464b09eea).(const int writemask); |
| 372 | int writemask_xcxx . . $ writemask_x(7864480464b09eea).(const int writemask); |
| 373 | int writemask_ycxx . . $ writemask_y(7864480464b09eea).(const int writemask); |
| 374 | int replicate_swizzlecxx . . $ replicate_swizzle(7864480464b09eea).(const int swizzle); |
| 375 | int no_swizzlecxx . . $ no_swizzle(7864480464b09eea).(const int swizzle); |
| 376 | int vecsize_from_writemaskcxx . . $ vecsize_from_writemask(7864480464b09eea).(const int m); |
| 377 | void set_dstarg_writemaskcxx . . $ set_dstarg_writemask(3dc30233075ee5d2).(DestArgInfocxx . . $ DestArgInfo# *dst, const int mask); |
| 378 | |
| 379 | int isscalarcxx . . $ isscalar(9d8abf502d86d4f4).(Contextcxx . . $ Context# *ctx, const MOJOSHADER_shaderTypecxx . . $ MOJOSHADER_shaderType# shader_type, |
| 380 | const RegisterTypecxx . . $ RegisterType# rtype, const int rnum); |
| 381 | |
| 382 | static const char swizzle_channelscxx . . $ swizzle_channels.[] = { 'x', 'y', 'z', 'w' }; |
| 383 | |
| 384 | const char *get_D3D_register_stringcxx . . $ get_D3D_register_string(e11e601b5c61efa5).(Contextcxx . . $ Context# *ctx, |
| 385 | RegisterTypecxx . . $ RegisterType# regtype, |
| 386 | int regnum, char *regnum_str, |
| 387 | size_t regnum_size); |
| 388 | |
| 389 | // !!! FIXME: These should stay in the mojoshader_profile_d3d file |
| 390 | // !!! FIXME: but ARB1 relies on them, so we have to move them here. |
| 391 | // !!! FIXME: If/when we kill off ARB1, we can move these back. |
| 392 | const char *get_D3D_varname_in_bufcxx . . $ get_D3D_varname_in_buf(e11e601b5c61efa5).(Contextcxx . . $ Context# *ctx, RegisterTypecxx . . $ RegisterType# rt, |
| 393 | int regnum, char *buf, |
| 394 | const size_t len); |
| 395 | const char *get_D3D_varnamecxx . . $ get_D3D_varname(790d45e57673741b).(Contextcxx . . $ Context# *ctx, RegisterTypecxx . . $ RegisterType# rt, int regnum); |
| 396 | |
| 397 | #endif |