Ryulord
Ryulord
MModular
Created by Khaled M' on 4/1/2024 in #questions
Does anyone think Mojo could be great for Game Development?
The problem is that GPUs still have a bunch of fixed function hardware for certain parts of the graphics pipeline that isn't usable with GPGPU tools. I would love to see Mojo support that somehow in the future but right now a shader based rendering approach will have significantly worse performance than a proper graphics API. I just started playing around with some vulkan bindings the other night. Will let everyone know if I come up with a nice to use interface because yeah, it's definitely "C programmer brained" in its design
55 replies
MModular
Created by Tom Gale on 9/9/2024 in #community-showcase
mo3d: 3D library for Mojo
Nice! You may also want to check out these sdl bindings as they're a little bit more up to date than msteele's (I also found theirs very helpful for getting started) https://github.com/Ryul0rd/sdl-bindings
15 replies
MModular
Created by Khaled M' on 4/1/2024 in #questions
Does anyone think Mojo could be great for Game Development?
I don't think there is natively but there must be a way to do it in C so you could use C bindings
55 replies
MModular
Created by Khaled M' on 4/1/2024 in #questions
Does anyone think Mojo could be great for Game Development?
yeah, Mojo also appealed to me as "python but I can just ship a binary like a real language"
55 replies
MModular
Created by Khaled M' on 4/1/2024 in #questions
Does anyone think Mojo could be great for Game Development?
If large studios do start adopting it it probably wouldn't be through unity/unreal. Apparently there have already been 1 or 2 big studios that made in house engines in Rust so I imagine something similar would happen if Mojo became popular in AAA
55 replies
MModular
Created by Khaled M' on 4/1/2024 in #questions
Does anyone think Mojo could be great for Game Development?
just because unreal and unity are the big two engines doesn't mean they need to adopt mojo for it to see success. It could be adopted by Godot (seems very likely even due to their plugin system) which is getting more popular, there could be a new engine written from scratch in Mojo that gets popular, or there could be a new engine written from scratch in Mojo that never gets popular but is still a good engine that is worth using (popular != good)
55 replies
MModular
Created by Tyoma Makeev on 9/8/2024 in #questions
What's the thing with global variables?
6 replies
MModular
Created by cirqol on 9/8/2024 in #questions
Just learn Mojo?
If you're trying to land a job or even just be productive Python is very much still the way to go for now. If you're just trying to learn though building everything from scratch in Mojo is a great way to do that
4 replies
MModular
Created by Firas on 9/7/2024 in #questions
How to random int ??
var a: UInt32 = 42
var b = int(a)
var a: UInt32 = 42
var b = int(a)
Scalar types like UInt32 are just aliases for simd types like SIMD[DType.uint32, 1]
5 replies
MModular
Created by Helehex on 8/21/2024 in #community-showcase
Dustbin
yeah this would also work
69 replies
MModular
Created by Helehex on 8/21/2024 in #community-showcase
Dustbin
I was looking into doing this but the sdl bindings currently use mojo nightly and magic doesn't support nightly yet. Definitely going to try to get that working once next stable drops
69 replies
MModular
Created by toasty on 8/14/2024 in #community-showcase
Reading from stdin
have you considered making a PR to get this in the standard lib? We really should have input
17 replies
MModular
Created by Helehex on 8/5/2024 in #community-showcase
Thermo
That is consistent with the issues we were running into. Does this means that all bindings will have to live inside of a struct instance? The ergonomics there aren't great. Static linking or proper global dynamic linking would be nice to have
49 replies
MModular
Created by Helehex on 8/5/2024 in #community-showcase
Thermo
Which is currently blocked by https://github.com/modularml/mojo/issues/3316
49 replies
MModular
Created by xentropy on 8/9/2024 in #questions
Is this broken or is it me? Parameterized function alias...
You can't parameterize a runtime value. Parameterization means the compiler actually makes a specialized version of the thing and so it needs to happen at compile time.
15 replies
MModular
Created by xentropy on 8/9/2024 in #questions
Is this broken or is it me? Parameterized function alias...
You can parametrize just a function but having a method and a field on a struct both parameterized in the same way requires you to parameterize the struct. It's not clear to me why you need the struct without knowing more about the use case but you might be better off with just a function
15 replies
MModular
Created by xentropy on 8/9/2024 in #questions
Is this broken or is it me? Parameterized function alias...
also you forgot to cast from Int32 to UInt8
15 replies
MModular
Created by xentropy on 8/9/2024 in #questions
Is this broken or is it me? Parameterized function alias...
This works:
fn example_fn_1[X: Int](default: Int32) -> SIMD[DType.uint8, X]:
return SIMD[DType.uint8, X](default.cast[DType.uint8]())


struct ExampleStruct[L: Int]:
var example_fn: fn(Int32) -> SIMD[DType.uint8, L]

fn __init__(inout self):
self.example_fn = example_fn_1[L]

fn make_buffer_ok(inout self, default: Int32) -> SIMD[DType.uint8, L]:
return example_fn_1[L](default)

fn make_buffer_sad(inout self, default: Int32) -> SIMD[DType.uint8, L]:
return self.example_fn(default)
fn example_fn_1[X: Int](default: Int32) -> SIMD[DType.uint8, X]:
return SIMD[DType.uint8, X](default.cast[DType.uint8]())


struct ExampleStruct[L: Int]:
var example_fn: fn(Int32) -> SIMD[DType.uint8, L]

fn __init__(inout self):
self.example_fn = example_fn_1[L]

fn make_buffer_ok(inout self, default: Int32) -> SIMD[DType.uint8, L]:
return example_fn_1[L](default)

fn make_buffer_sad(inout self, default: Int32) -> SIMD[DType.uint8, L]:
return self.example_fn(default)
There were a couple problems. 1. It looks like like you can't parameterize a parametric function pointer type in an alias. Not sure why though. 2. Your struct needed to be parameterized at the struct level so it knows that the different parts are parameterized in the same way.
15 replies
MModular
Created by Ryulord on 8/5/2024 in #questions
MLIR Docs
yeah I guess it being considered part of the compiler or not is just semantics and not irrelevant. It's just a case of if Modular wants to document it or not and why. You can kinda figure out bits of what's going on through error messages and things so I doubt they consider it a well guarded secret the way the would with other stuff they haven't opened up
12 replies
MModular
Created by Ryulord on 8/5/2024 in #questions
MLIR Docs
There have been statements in the past like (paraphrasing) "things you'd normally need a compiler engineer for in Mojo you can just have an ordinary programmer do because you can just write inline MLIR". Statements like this seem odd if the MLIR you need to use is really part of the compiler
12 replies