Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

D3D10 shader module #260

Merged
merged 1 commit into from
Mar 14, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 110 additions & 0 deletions src/d3d10shader.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
// Copyright © 2016, Peter Atashian
// Licensed under the MIT License <LICENSE.md>
use super::*;
pub type D3D10_RESOURCE_RETURN_TYPE = D3D_RESOURCE_RETURN_TYPE;
pub type D3D10_CBUFFER_TYPE = D3D_CBUFFER_TYPE;
STRUCT!{struct D3D10_SHADER_DESC {
Version: UINT,
Creator: LPCSTR,
Flags: UINT,
ConstantBuffers: UINT,
BoundResources: UINT,
InputParameters: UINT,
OutputParameters: UINT,
InstructionCount: UINT,
TempRegisterCount: UINT,
TempArrayCount: UINT,
DefCount: UINT,
DclCount: UINT,
TextureNormalInstructions: UINT,
TextureLoadInstructions: UINT,
TextureCompInstructions: UINT,
TextureBiasInstructions: UINT,
TextureGradientInstructions: UINT,
FloatInstructionCount: UINT,
IntInstructionCount: UINT,
UintInstructionCount: UINT,
StaticFlowControlCount: UINT,
DynamicFlowControlCount: UINT,
MacroInstructionCount: UINT,
ArrayInstructionCount: UINT,
CutInstructionCount: UINT,
EmitInstructionCount: UINT,
GSOutputTopology: D3D_PRIMITIVE_TOPOLOGY,
GSMaxOutputVertexCount: UINT,
}}
STRUCT!{struct D3D10_SHADER_BUFFER_DESC {
Name: LPCSTR,
Type: D3D10_CBUFFER_TYPE,
Variables: UINT,
Size: UINT,
uFlags: UINT,
}}
STRUCT!{struct D3D10_SHADER_VARIABLE_DESC {
Name: LPCSTR,
StartOffset: UINT,
Size: UINT,
uFlags: UINT,
DefaultValue: LPVOID,
}}
STRUCT!{struct D3D10_SHADER_TYPE_DESC {
Class: D3D_SHADER_VARIABLE_CLASS,
Type: D3D_SHADER_VARIABLE_TYPE,
Rows: UINT,
Columns: UINT,
Elements: UINT,
Members: UINT,
Offset: UINT,
}}
STRUCT!{struct D3D10_SHADER_INPUT_BIND_DESC {
Name: LPCSTR,
Type: D3D_SHADER_INPUT_TYPE,
BindPoint: UINT,
BindCount: UINT,
uFlags: UINT,
ReturnType: D3D_RESOURCE_RETURN_TYPE,
Dimension: D3D_SRV_DIMENSION,
NumSamples: UINT,
}}
STRUCT!{struct D3D10_SIGNATURE_PARAMETER_DESC {
SemanticName: LPCSTR,
SemanticIndex: UINT,
Register: UINT,
SystemValueType: D3D_NAME,
ComponentType: D3D_REGISTER_COMPONENT_TYPE,
Mask: BYTE,
ReadWriteMask: BYTE,
}}
RIDL!{interface ID3D10ShaderReflectionType(ID3D10ShaderReflectionTypeVtbl) {
fn GetDesc(&mut self, pDesc: *mut D3D10_SHADER_TYPE_DESC) -> HRESULT,
fn GetMemberTypeByIndex(&mut self, Index: UINT) -> *mut ID3D10ShaderReflectionType,
fn GetMemberTypeByName(&mut self, Name: LPCSTR) -> *mut ID3D10ShaderReflectionType,
fn GetMemberTypeName(&mut self, Index: UINT) -> LPCSTR
}}
RIDL!{interface ID3D10ShaderReflectionVariable(ID3D10ShaderReflectionVariableVtbl) {
fn GetDesc(&mut self, pDesc: *mut D3D10_SHADER_VARIABLE_DESC) -> HRESULT,
fn GetType(&mut self) -> *mut ID3D10ShaderReflectionType
}}
RIDL!{interface ID3D10ShaderReflectionConstantBuffer(ID3D10ShaderReflectionConstantBufferVtbl) {
fn GetDesc(&mut self, pDesc: *mut D3D10_SHADER_BUFFER_DESC) -> HRESULT,
fn GetVariableByIndex(&mut self, Index: UINT) -> *mut ID3D10ShaderReflectionVariable,
fn GetVariableByName(&mut self, Name: LPCSTR) -> *mut ID3D10ShaderReflectionVariable
}}
RIDL!{interface ID3D10ShaderReflection(ID3D10ShaderReflectionVtbl): IUnknown(IUnknownVtbl) {
fn GetDesc(&mut self, pDesc: *mut D3D10_SHADER_DESC) -> HRESULT,
fn GetConstantBufferByIndex(
&mut self, Index: UINT
) -> *mut ID3D10ShaderReflectionConstantBuffer,
fn GetConstantBufferByName(
&mut self, Name: LPCSTR
) -> *mut ID3D10ShaderReflectionConstantBuffer,
fn GetResourceBindingDesc(
&mut self, ResourceIndex: UINT, pDesc: *mut D3D10_SHADER_INPUT_BIND_DESC
) -> HRESULT,
fn GetInputParameterDesc(
&mut self, ParameterIndex: UINT, pDesc: *mut D3D10_SIGNATURE_PARAMETER_DESC
) -> HRESULT,
fn GetOutputParameterDesc(
&mut self, ParameterIndex: UINT, pDesc: *mut D3D10_SIGNATURE_PARAMETER_DESC
) -> HRESULT
}}
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ pub use d3d9::*;
pub use d3d9caps::*;
pub use d3d9types::*;
pub use d3d11::*;
pub use d3d10shader::*;
pub use d3d11shader::*;
pub use d3d12::*;
pub use d3d12sdklayers::*;
Expand Down Expand Up @@ -186,6 +187,7 @@ pub mod d3d9;
pub mod d3d9caps;
pub mod d3d9types;
pub mod d3d11;
pub mod d3d10shader;
pub mod d3d11shader;
pub mod d3d12;
pub mod d3d12sdklayers;
Expand Down