Skip to content

Instantly share code, notes, and snippets.

@pjoe
Created August 17, 2020 13:52
Show Gist options
  • Save pjoe/76ddaa062c602c7e59fff899a115fc92 to your computer and use it in GitHub Desktop.
Save pjoe/76ddaa062c602c7e59fff899a115fc92 to your computer and use it in GitHub Desktop.
naga Rosetta experiment
(
header: (
version: (1, 0, 0),
generator: 0,
),
types: [
(
name: None,
inner: Vector(
size: Bi,
kind: Float,
width: 4,
),
),
(
name: None,
inner: Scalar(
kind: Float,
width: 4,
),
),
(
name: None,
inner: Vector(
size: Quad,
kind: Float,
width: 4,
),
),
],
constants: [
(
name: None,
specialization: None,
inner: Float(1),
ty: 2,
),
(
name: None,
specialization: None,
inner: Float(0),
ty: 2,
),
],
global_variables: [
(
name: Some("a_pos"),
class: Input,
binding: Some(Location(0)),
ty: 1,
),
(
name: Some("gl_Position"),
class: Output,
binding: Some(BuiltIn(Position)),
ty: 3,
),
],
functions: [
(
name: Some("main"),
parameter_types: [],
return_type: None,
global_usage: [],
local_variables: [
(
name: Some("w"),
ty: 2,
init: Some(1),
),
],
expressions: [
Constant(1),
GlobalVariable(2),
GlobalVariable(1),
Constant(2),
LocalVariable(1),
Compose(
ty: 3,
components: [
3,
4,
5,
],
),
],
body: [
Block([]),
Store(
pointer: 2,
value: 6,
),
],
),
],
entry_points: [
(
stage: Vertex,
name: "main",
function: 1,
),
],
)
17,18c17
< inner: Vector(
< size: Quad,
---
> inner: Scalar(
25c24,25
< inner: Scalar(
---
> inner: Vector(
> size: Quad,
36c36
< ty: 3,
---
> ty: 2,
42c42
< ty: 3,
---
> ty: 2,
56c56
< ty: 2,
---
> ty: 3,
64,71c64
< global_usage: [
< (
< bits: 1,
< ),
< (
< bits: 2,
< ),
< ],
---
> global_usage: [],
75,76c68,69
< ty: 3,
< init: Some(3),
---
> ty: 2,
> init: Some(1),
80,81d72
< GlobalVariable(1),
< GlobalVariable(2),
83c74,75
< LocalVariable(1),
---
> GlobalVariable(2),
> GlobalVariable(1),
84a77
> LocalVariable(1),
86c79
< ty: 2,
---
> ty: 3,
88,89c81
< 1,
< 5,
---
> 3,
90a83
> 5,
95c88
< Empty,
---
> Block([]),
99,101d91
< ),
< Return(
< value: None,
(
header: (
version: (1, 0, 0),
generator: 0,
),
types: [
(
name: None,
inner: Vector(
size: Bi,
kind: Float,
width: 4,
),
),
(
name: None,
inner: Vector(
size: Quad,
kind: Float,
width: 4,
),
),
(
name: None,
inner: Scalar(
kind: Float,
width: 4,
),
),
],
constants: [
(
name: None,
specialization: None,
inner: Float(1),
ty: 3,
),
(
name: None,
specialization: None,
inner: Float(0),
ty: 3,
),
],
global_variables: [
(
name: Some("a_pos"),
class: Input,
binding: Some(Location(0)),
ty: 1,
),
(
name: Some("gl_Position"),
class: Output,
binding: Some(BuiltIn(Position)),
ty: 2,
),
],
functions: [
(
name: Some("main"),
parameter_types: [],
return_type: None,
global_usage: [
(
bits: 1,
),
(
bits: 2,
),
],
local_variables: [
(
name: Some("w"),
ty: 3,
init: Some(3),
),
],
expressions: [
GlobalVariable(1),
GlobalVariable(2),
Constant(1),
LocalVariable(1),
Constant(2),
Compose(
ty: 2,
components: [
1,
5,
4,
],
),
],
body: [
Empty,
Store(
pointer: 2,
value: 6,
),
Return(
value: None,
),
],
),
],
entry_points: [
(
stage: Vertex,
name: "main",
function: 1,
),
],
)
#version 450 core
layout(location = 0) in vec2 a_pos;
void main() {
float w = 1.0;
gl_Position = vec4(a_pos, 0.0, w);
}
# vertex
[[location 0]] var<in> a_pos : vec2<f32>;
[[builtin position]] var<out> gl_Position : vec4<f32>;
fn main() -> void {
var w: f32 = 1.0;
gl_Position = vec4<f32>(a_pos, 0.0, w);
return;
}
entry_point vertex as "main" = main;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment