Commit Graph

17855 Commits

Author SHA1 Message Date
Brendan Punsky
18f9f141e4 rexcode/ir/spirv: encoder foundation -- header + preamble/debug/annotation sections
The Module -> word-stream encoder's first half: a fast single-pass word writer
(one host-endian store per word; instruction headers written as a placeholder
and backpatched, so variable-length instructions need no measure pass) plus the
header and the preamble / debug / annotation sections in spec layout order
(capabilities, extensions, ext-inst imports, memory model, entry points,
execution modes, OpString/OpSource/OpName, decorations).

Validated: a minimal module encodes to byte-exact-correct SPIR-V (magic, v1.5,
OpCapability Shader, OpMemoryModel Logical GLSL450, OpEntryPoint GLCompute %main,
NUL-terminated 'main' string, correct backpatched word counts).

Types/constants/globals/function bodies (the <id> + type lowering) are next.
2026-06-26 07:33:01 -04:00
Brendan Punsky
d027fbf938 rexcode/ir/spirv: generate the operand-layout table (codec dispatch data)
Extend the tablegen to emit encoding_table.odin from the grammar -- the
per-opcode operand layout that drives the codec:

  INSTRUCTION_SPECS   flat []Operand_Spec {Spec_Kind, Quantifier}
  INSTRUCTION_INDEX   [max_opcode+1]Spec_Run -- O(1) opcode -> its operand run
  ENUM_PARAMS         enumerant -> trailing-parameter operands, so the codec
  PARAM_SPECS         reads MemoryAccess.Aligned / OpExecutionMode LocalSize /
                      Decoration.SpecId etc. correctly

873 opcodes, 3693 operand specs. Package compiles.
2026-06-26 07:08:50 -04:00
Brendan Punsky
7a8684f541 rexcode/ir/spirv: scaffold the SPIR-V IR package (foundation + generated tables)
Start the SPIR-V intermediate representation under core/rexcode/ir/spirv,
following the ir API (docs/ir_design.md) and the ISA package conventions. SPIR-V
is table-driven on encoding and SSA on dataflow, so it re-exports the shared ir
vocabulary and is laid out like an arch package.

  spirv.odin          package + ir re-exports + physical format (MAGIC, version,
                      Header, wordCount<<16|opcode framing)
  module.odin         Module :: struct { using base: ir.Module, ...sections... } --
                      capabilities, ext-imports, entry points, exec modes, constant
                      pool, decorations, debug; SPIR-V's module metadata has no
                      ir.Module slot, so it is carried alongside the core
  reloc.odin          Relocation (linkage import/export)
  opcodes.odin        GENERATED: the Opcode enum (873 opcodes)
  operand_kinds.odin  GENERATED: ValueEnum/BitEnum operand kinds + Spec_Kind
  tablegen/gen.odin   the generator (core:encoding/json)
  tablegen/spirv.core.grammar.json  vendored authoritative grammar (Khronos
                      SPIRV-Headers unified1) -- single source of truth

Generating from the authoritative grammar avoids hand-transcription errors
(hand-authoring had Quads/Aliased/... wrong). Package compiles. Codec
(encode/decode + flat<->structured lowering), printer, and tests are next.
2026-06-26 06:53:46 -04:00
Brendan Punsky
3d852158bc rexcode/x86: generate the encode-recipe table (drop the @init interim)
Move ENCODE_RECIPES from a startup-built (@init) static table in the library to
a generated, #loaded table like every other one. The tablegen runs
form_to_recipe over every form, serializes to x86.encode_recipes.bin, and the
loader #loads it -- no @init, no allocation; the forms remain the single source
of truth and the recipe is derived from them.

- tablegen/gen.odin: ENCODE_RECIPES added to the BLOBS manifest (which drives
  both the Stage B serializer and the loader's #load); emit the generated-package
  global plus an @init that fills it from ENCODE_FORMS via lib.form_to_recipe.
- encoder_recipe.odin: drop the @init, the static storage, and the ENCODE_RECIPES
  declaration. form_to_recipe stays -- now solely the tablegen-time derivation.
- tables.odin, generated/{encode_tables,writer}.odin: regenerated.
- tables/x86.encode_recipes.bin: the generated blob (28260 bytes = 2355 x 12).

No behavior change: the recipes are identical to the @init ones. gen / builders /
check / test / idempotent green (2282 cases, 22 byte-stable artifacts); encode
perf unchanged.
2026-06-26 05:08:39 -04:00
gingerBill
19bb9070e1 Add @(require_results) where missing 2026-06-23 13:24:25 +01:00
gingerBill
f3a275c4dc Merge branch 'master' into bill/rexcode 2026-06-23 13:21:46 +01:00
gingerBill
8c63a70aad Fix identation 2026-06-23 13:14:56 +01:00
gingerBill
87297950c1 Merge pull request #6435 from mtarik34b/improve-flags-bitset-support
Improve `bit_set` support in the `flags` package
2026-06-23 12:50:21 +01:00
gingerBill
2b684ed1ec Add json.unparse allowing for json.Value to io.Writer without the need for RTTI 2026-06-23 12:47:38 +01:00
gingerBill
6698ebacb1 Integrate docs from PR #5119 2026-06-23 12:35:58 +01:00
gingerBill
a1fe7222bb Remove using fmt for example docs 2026-06-23 12:28:27 +01:00
gingerBill
28df949279 Fix typo 2026-06-23 12:25:36 +01:00
gingerBill
ebcf85a1fd Merge branch 'master' of https://github.com/odin-lang/Odin 2026-06-23 12:21:39 +01:00
gingerBill
7d36866fe9 pool -> arena 2026-06-23 12:21:29 +01:00
gingerBill
dc7cfbf443 Merge pull request #6671 from MaierN/master
fix memory leak and inconsistency in os.read_entire_file_from_file
2026-06-23 12:20:36 +01:00
gingerBill
82b2b293e9 Merge pull request #6515 from Peter0x44/master
Add missing rlgl bindings for raylib 5.5
2026-06-23 12:19:08 +01:00
gingerBill
1b75c44508 Change mem.Dynamic_Arena's alignment to be minimum_alignment 2026-06-23 12:18:15 +01:00
gingerBill
e30da0beb3 Remove old dynamic_pool_ aliases 2026-06-23 12:10:26 +01:00
gingerBill
bc1d6eb240 Merge branch 'master' of https://github.com/odin-lang/Odin 2026-06-23 12:10:00 +01:00
gingerBill
a95d45e913 Fix typo 2026-06-23 12:09:51 +01:00
gingerBill
3b56706439 Merge pull request #6471 from Carlyle-Foster/master
rename DEFAULT_PAGE_SIZE to PAGE_SIZE
2026-06-23 12:08:37 +01:00
gingerBill
8f83598750 Correct numerous issues with SDL3 and add missing procedures 2026-06-23 12:03:36 +01:00
gingerBill
0fdc0fd9da Merge pull request #5662 from leecommamichael/stbtt_types
[vendor:stb_truetype] amend PackFontRanges types
2026-06-23 11:51:19 +01:00
gingerBill
e3729aefc3 Add Maybe to SDL3 RenderGeometry 2026-06-23 11:50:33 +01:00
gingerBill
5ba39f42ea Improve error message on calls with varying argument count 2026-06-23 11:49:00 +01:00
gingerBill
a20363c2bf Add windows.GetConsoleScreenBufferInfoEx 2026-06-23 11:46:37 +01:00
gingerBill
8397c83560 Merge pull request #5508 from Paul-Andre/print-errors-before-assert
Flush accumulated errors before printing assert
2026-06-23 11:41:48 +01:00
gingerBill
38fa18023d Use intrinsics.count_leading_zeros internally for math.next_power_of_two 2026-06-23 11:39:19 +01:00
gingerBill
8afac0f32f Ignore the previous commit :D 2026-06-22 16:15:26 +01:00
gingerBill
13832011fa Add core:time/tzdata to examples/all 2026-06-22 16:12:44 +01:00
gingerBill
36e14eba48 Merge branch 'master' into bill/rexcode 2026-06-22 15:44:52 +01:00
gingerBill
3bbeecea41 Merge branch 'master' of https://github.com/odin-lang/Odin 2026-06-22 15:41:52 +01:00
gingerBill
d16a37e649 Add warning to help very large return values (partially fixes #6568) 2026-06-22 15:41:43 +01:00
Jeroen van Rijn
6bae6eb3f1 Clarify "it" 2026-06-22 15:46:02 +02:00
Jeroen van Rijn
8148b04a6c Add missing word. 2026-06-22 15:44:11 +02:00
Jeroen van Rijn
778d3b97b6 Add comment to odin root about why there's no newline
Add comment to `odin root` about why there's no newline, and why we closed #6834 and #6871.

Future such pull requests will be closed without comment.
2026-06-22 15:40:21 +02:00
gingerBill
6cf57c1eaa Fix #6863 2026-06-22 13:17:43 +01:00
gingerBill
d1eaf5a209 Merge branch 'master' into bill/rexcode 2026-06-22 12:58:36 +01:00
gingerBill
c843f3bb65 Optimize append_elem for different optimization levels
* For `-o:size` and below, uses the type erased approach
* For `-o:speed` and above, the inlined form is used

This is necessary because a generic `mem_copy_non_overlapping` cannot be optimized when type erasure is used, meaning in a hot path where `append_elem` is used a lot; thus `mem_copy_non_overlapping` becomes a bottleneck.
2026-06-22 12:57:00 +01:00
gingerBill
3834aeec49 Compiler: Improve error propagation when all of the overloads have the same return values 2026-06-22 12:56:25 +01:00
gingerBill
233242f4ea Remove __copy_bits 2026-06-22 12:55:56 +01:00
gingerBill
2aea1d13f1 Improve lb_copy_bits 2026-06-22 12:55:50 +01:00
gingerBill
8971e0f1ec Fix shifting buf in lb_copy_bits 2026-06-22 12:55:45 +01:00
gingerBill
588a8148f2 Remove the now defunct __write_bits and __read_bits 2026-06-22 12:55:33 +01:00
gingerBill
900ebd6b5b Heavily improve reading and writing to bit fields 2026-06-22 12:55:29 +01:00
gingerBill
244430bd4a Allow for struct #raw_union #packed 2026-06-22 12:55:15 +01:00
gingerBill
b3f6d9ce9b doc_writer: String intern constant values expressions 2026-06-22 12:54:50 +01:00
gingerBill
6af1fe3e22 doc writer: Use string interning and minimize the size of the compound literal generation when it is HUGE 2026-06-22 12:54:43 +01:00
gingerBill
a7186b8af0 Minimize error propagation of map[key] indexing 2026-06-22 12:54:02 +01:00
gingerBill
baef272bbd Support constant compound literals 2026-06-22 12:53:27 +01:00