-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sr: Turn some of the instructions into sesparate structs, add module …
…types
- Loading branch information
Showing
8 changed files
with
205 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// Copyright 2016 Google Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
// AUTOMATICALLY GENERATED from the SPIR-V JSON grammar: | ||
// external/spirv.core.grammar.json. | ||
// DO NOT MODIFY! | ||
|
||
#[derive(Clone, Debug, Eq, PartialEq)] | ||
pub struct Extension { | ||
name: String, | ||
} | ||
#[derive(Clone, Debug, Eq, PartialEq)] | ||
pub struct ExtInstImport { | ||
name: String, | ||
} | ||
#[derive(Clone, Debug, Eq, PartialEq)] | ||
pub struct MemoryModel { | ||
addressing_model: spirv::AddressingModel, | ||
memory_model: spirv::MemoryModel, | ||
} | ||
#[derive(Clone, Debug, Eq, PartialEq)] | ||
pub struct EntryPoint { | ||
execution_model: spirv::ExecutionModel, | ||
entry_point: spirv::Word, | ||
name: String, | ||
interface: Vec<spirv::Word>, | ||
} | ||
#[derive(Clone, Debug, Eq, PartialEq)] | ||
pub struct ExecutionMode { | ||
entry_point: spirv::Word, | ||
mode: spirv::ExecutionMode, | ||
} | ||
#[derive(Clone, Debug, Eq, PartialEq)] | ||
pub struct Capability { | ||
capability: spirv::Capability, | ||
} | ||
#[derive(Clone, Debug, Eq, PartialEq)] | ||
pub struct Function { | ||
function_control: spirv::FunctionControl, | ||
function_type: spirv::Word, | ||
} | ||
#[derive(Clone, Debug, Eq, PartialEq)] | ||
pub struct FunctionParameter {} | ||
#[derive(Clone, Debug, Eq, PartialEq)] | ||
pub struct FunctionEnd {} | ||
#[derive(Clone, Debug, Eq, PartialEq)] | ||
pub struct Label {} | ||
#[derive(Clone, Debug, Eq, PartialEq)] | ||
pub struct ExecutionModeId { | ||
entry_point: spirv::Word, | ||
mode: spirv::ExecutionMode, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
use spirv; | ||
|
||
include!("autogen_instruction_enums.rs"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
use crate::{ | ||
mr::ModuleHeader, | ||
sr::{op, Token}, | ||
sr::instructions::Terminator, | ||
sr::types::{Type}, | ||
}; | ||
use spirv; | ||
|
||
pub struct EntryPoint { | ||
pub execution_model: spirv::ExecutionModel, | ||
pub entry_point: Token<Function>, | ||
pub name: String, | ||
//pub interface: Vec<spirv::Word>, | ||
} | ||
|
||
pub struct BasicBlock { | ||
pub terminator: Terminator, | ||
} | ||
|
||
pub struct Function { | ||
pub control: spirv::FunctionControl, | ||
/// Function result type. | ||
pub result: Token<Type>, | ||
/// Function parameters. | ||
pub parameters: Vec<Token<Type>>, | ||
/// Basic blocks in this function. | ||
pub basic_blocks: Vec<BasicBlock>, | ||
} | ||
|
||
pub struct Module { | ||
/// The module header. | ||
pub header: Option<ModuleHeader>, | ||
/// All OpCapability instructions. | ||
pub capabilities: Vec<op::Capability>, | ||
/// All OpExtension instructions. | ||
pub extensions: Vec<op::Extension>, | ||
/// All OpExtInstImport instructions. | ||
pub ext_inst_imports: Vec<op::ExtInstImport>, | ||
/// The OpMemoryModel instruction. | ||
/// | ||
/// Although it is required by the specification to appear exactly once | ||
/// per module, we keep it optional here to allow flexibility. | ||
pub memory_model: Option<op::MemoryModel>, | ||
/// All entry point declarations, using OpEntryPoint. | ||
pub entry_points: Vec<op::EntryPoint>, | ||
/// All execution mode declarations, using OpExecutionMode. | ||
pub execution_modes: Vec<op::ExecutionMode>, | ||
|
||
// some missing here... | ||
|
||
/// All functions. | ||
pub functions: Vec<Function>, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
use spirv; | ||
|
||
include!("autogen_instruction_structs.rs"); |