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

Add D3D10 things #965

Open
wants to merge 5 commits into
base: 0.3
Choose a base branch
from
Open
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
14 changes: 7 additions & 7 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,13 @@ const DATA: &'static [(&'static str, &'static [&'static str], &'static [&'static
("d2d1svg", &["basetsd", "d2d1", "d2d1_1", "guiddef", "minwindef", "ntdef", "objidlbase", "winerror"], &[]),
("d2dbasetypes", &["d3d9types", "dcommon"], &[]),
("d3d", &[], &[]),
("d3d10", &["d3dcommon"], &[]),
("d3d10_1", &[], &[]),
("d3d10_1shader", &[], &[]),
("d3d10effect", &[], &[]),
("d3d10misc", &[], &[]),
("d3d10sdklayers", &[], &[]),
("d3d10shader", &["d3d10", "d3dcommon", "minwindef", "unknwnbase", "winnt"], &[]),
("d3d10", &["basetsd", "d3dcommon", "dxgiformat", "dxgitype", "guiddef", "minwindef", "unknwnbase", "windef", "winnt"], &[]),
("d3d10_1", &["basetsd", "d3d10", "d3d10misc", "d3dcommon", "dxgi", "dxgiformat", "minwindef", "winnt"], &[]),
("d3d10_1shader", &["d3d10", "d3d10shader", "minwindef", "winnt"], &[]),
("d3d10effect", &["basetsd", "d3d10", "d3d10shader", "d3dcommon", "minwindef", "unknwnbase", "winnt"], &[]),
("d3d10misc", &["d3d10", "dxgi", "minwindef", "winnt"], &[]),
("d3d10sdklayers", &["basetsd", "dxgi", "minwindef", "unknwnbase", "winnt"], &[]),
("d3d10shader", &["basetsd", "d3d10", "d3dcommon", "minwindef", "unknwnbase", "winnt"], &[]),
("d3d11", &["basetsd", "d3dcommon", "dxgi", "dxgiformat", "dxgitype", "guiddef", "minwindef", "unknwnbase", "windef", "winnt"], &["d3d11"]),
("d3d11_1", &["basetsd", "d3d11", "d3dcommon", "dxgiformat", "dxgitype", "guiddef", "minwindef", "unknwnbase", "winnt"], &[]),
("d3d11_2", &["basetsd", "d3d11", "d3d11_1", "dxgiformat", "minwindef", "winnt"], &[]),
Expand Down
1,427 changes: 1,427 additions & 0 deletions src/um/d3d10.rs

Large diffs are not rendered by default.

134 changes: 134 additions & 0 deletions src/um/d3d10_1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,140 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
// All files in the project carrying such notice may not be copied, modified, or distributed
// except according to those terms.
use shared::basetsd::UINT8;
use shared::dxgi::{DXGI_SWAP_CHAIN_DESC, IDXGIAdapter, IDXGISwapChain};
use shared::dxgiformat::DXGI_FORMAT;
use shared::minwindef::{BOOL, DWORD, FLOAT, HMODULE, UINT};
use um::d3d10::{
D3D10_BLEND, D3D10_BLEND_OP, D3D10_BUFFER_SRV, D3D10_TEX1D_ARRAY_SRV, D3D10_TEX1D_SRV,
D3D10_TEX2DMS_ARRAY_SRV, D3D10_TEX2DMS_SRV, D3D10_TEX2D_ARRAY_SRV, D3D10_TEX2D_SRV,
D3D10_TEX3D_SRV, D3D10_TEXCUBE_SRV, ID3D10BlendState, ID3D10BlendStateVtbl, ID3D10Device,
ID3D10DeviceVtbl, ID3D10Resource, ID3D10ShaderResourceView, ID3D10ShaderResourceViewVtbl
};
use um::d3d10misc::D3D10_DRIVER_TYPE;
use um::d3dcommon::D3D_SRV_DIMENSION;
use um::winnt::HRESULT;
pub const D3D10_1_DEFAULT_SAMPLE_MASK: DWORD = 0xffffffff;
pub const D3D10_1_FLOAT16_FUSED_TOLERANCE_IN_ULP: FLOAT = 0.6;
pub const D3D10_1_FLOAT32_TO_INTEGER_TOLERANCE_IN_ULP: FLOAT = 0.6;
pub const D3D10_1_GS_INPUT_REGISTER_COUNT: DWORD = 32;
pub const D3D10_1_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT: DWORD = 32;
pub const D3D10_1_IA_VERTEX_INPUT_STRUCTURE_ELEMENTS_COMPONENTS: DWORD = 128;
pub const D3D10_1_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT: DWORD = 32;
pub const D3D10_1_PS_OUTPUT_MASK_REGISTER_COMPONENTS: DWORD = 1;
pub const D3D10_1_PS_OUTPUT_MASK_REGISTER_COMPONENT_BIT_COUNT: DWORD = 32;
pub const D3D10_1_PS_OUTPUT_MASK_REGISTER_COUNT: DWORD = 1;
pub const D3D10_1_SHADER_MAJOR_VERSION: DWORD = 4;
pub const D3D10_1_SHADER_MINOR_VERSION: DWORD = 1;
pub const D3D10_1_SO_BUFFER_MAX_STRIDE_IN_BYTES: DWORD = 2048;
pub const D3D10_1_SO_BUFFER_MAX_WRITE_WINDOW_IN_BYTES: DWORD = 256;
pub const D3D10_1_SO_BUFFER_SLOT_COUNT: DWORD = 4;
pub const D3D10_1_SO_MULTIPLE_BUFFER_ELEMENTS_PER_BUFFER: DWORD = 1;
pub const D3D10_1_SO_SINGLE_BUFFER_COMPONENT_LIMIT: DWORD = 64;
pub const D3D10_1_STANDARD_VERTEX_ELEMENT_COUNT: DWORD = 32;
pub const D3D10_1_SUBPIXEL_FRACTIONAL_BIT_COUNT: DWORD = 8;
pub const D3D10_1_VS_INPUT_REGISTER_COUNT: DWORD = 32;
pub const D3D10_1_VS_OUTPUT_REGISTER_COUNT: DWORD = 32;
ENUM!{enum D3D10_FEATURE_LEVEL1 {
D3D10_FEATURE_LEVEL_10_0 = 0xa000,
D3D10_FEATURE_LEVEL_10_1 = 0xa100,
D3D10_FEATURE_LEVEL_9_1 = 0x9100,
D3D10_FEATURE_LEVEL_9_2 = 0x9200,
D3D10_FEATURE_LEVEL_9_3 = 0x9300,
}}
STRUCT!{struct D3D10_RENDER_TARGET_BLEND_DESC1 {
BlendEnable: BOOL,
SrcBlend: D3D10_BLEND,
DestBlend: D3D10_BLEND,
BlendOp: D3D10_BLEND_OP,
SrcBlendAlpha: D3D10_BLEND,
DestBlendAlpha: D3D10_BLEND,
BlendOpAlpha: D3D10_BLEND_OP,
RenderTargetWriteMask: UINT8,
}}
STRUCT!{struct D3D10_BLEND_DESC1 {
AlphaToCoverageEnable: BOOL,
IndependentBlendEnable: BOOL,
RenderTarget: [D3D10_RENDER_TARGET_BLEND_DESC1; 8],
}}
RIDL!{#[uuid(0x9b7e4e00, 0x342c, 0x4106, 0xa1, 0x9f, 0x4f, 0x27, 0x04, 0xf6, 0x89, 0xf0)]
interface ID3D10BlendState1(ID3D10BlendState1Vtbl): ID3D10BlendState(ID3D10BlendStateVtbl) {
fn GetDesc1(
pDesc: *mut D3D10_BLEND_DESC1,
) -> (),
}}
STRUCT!{struct D3D10_TEXCUBE_ARRAY_SRV1 {
MostDetailedMip: UINT,
MipLevels: UINT,
First2DArrayFace: UINT,
NumCubes: UINT,
}}
pub type D3D10_SRV_DIMENSION1 = D3D_SRV_DIMENSION;
UNION!{union D3D10_SHADER_RESOURCE_VIEW_DESC1_u {
[u32; 4],
Buffer Buffer_mut: D3D10_BUFFER_SRV,
Texture1D Texture1D_mut: D3D10_TEX1D_SRV,
Texture1DArray Texture1DArray_mut: D3D10_TEX1D_ARRAY_SRV,
Texture2D Texture2D_mut: D3D10_TEX2D_SRV,
Texture2DArray Texture2DArray_mut: D3D10_TEX2D_ARRAY_SRV,
Texture2DMS Texture2DMS_mut: D3D10_TEX2DMS_SRV,
Texture2DMSArray Texture2DMSArray_mut: D3D10_TEX2DMS_ARRAY_SRV,
Texture3D Texture3D_mut: D3D10_TEX3D_SRV,
TextureCube TextureCube_mut: D3D10_TEXCUBE_SRV,
TextureCubeArray TextureCubeArray_mut: D3D10_TEXCUBE_ARRAY_SRV1,
}}
STRUCT!{struct D3D10_SHADER_RESOURCE_VIEW_DESC1 {
Format: DXGI_FORMAT,
ViewDimension: D3D10_SRV_DIMENSION1,
u: D3D10_SHADER_RESOURCE_VIEW_DESC1_u ,
}}
RIDL!{#[uuid(0x9b7e4c87, 0x342c, 0x4106, 0xa1, 0x9f, 0x4f, 0x27, 0x04, 0xf6, 0x89, 0xf0)]
interface ID3D10ShaderResourceView1(ID3D10ShaderResourceView1Vtbl):
ID3D10ShaderResourceView(ID3D10ShaderResourceViewVtbl) {
fn GetDesc1(
pDesc: *mut D3D10_SHADER_RESOURCE_VIEW_DESC1,
) -> (),
}}
ENUM!{enum D3D10_STANDARD_MULTISAMPLE_QUALITY_LEVELS {
D3D10_STANDARD_MULTISAMPLE_PATTERN = 0xffffffff,
D3D10_CENTER_MULTISAMPLE_PATTERN = 0xfffffffe,
}}
RIDL!{#[uuid(0x9b7e4c8f, 0x342c, 0x4106, 0xa1, 0x9f, 0x4f, 0x27, 0x04, 0xf6, 0x89, 0xf0)]
interface ID3D10Device1(ID3D10Device1Vtbl): ID3D10Device(ID3D10DeviceVtbl) {
fn CreateShaderResourceView1(
pResource: *mut ID3D10Resource,
pDesc: *const D3D10_SHADER_RESOURCE_VIEW_DESC1,
ppSRView: *mut *mut ID3D10ShaderResourceView1,
) -> HRESULT,
fn CreateBlendState1(
pBlendStateDesc: *const D3D10_BLEND_DESC1,
ppBlendState: *mut *mut ID3D10BlendState1,
) -> HRESULT,
fn GetFeatureLevel() -> D3D10_FEATURE_LEVEL1,
}}
pub const D3D10_1_SDK_VERSION: DWORD = 0x20;
extern "system" {
pub fn D3D10CreateDevice1(
pAdapter: *mut IDXGIAdapter,
DriverType: D3D10_DRIVER_TYPE,
Software: HMODULE,
Flags: UINT,
HardwareLevel: D3D10_FEATURE_LEVEL1,
SDKVersion: UINT,
ppDevice: *mut *mut ID3D10Device,
) -> HRESULT;
pub fn D3D10CreateDeviceAndSwapChain1(
pAdapter: *mut IDXGIAdapter,
DriverType: D3D10_DRIVER_TYPE,
Software: HMODULE,
Flags: UINT,
HardwareLevel: D3D10_FEATURE_LEVEL1,
SDKVersion: UINT,
pSwapChainDesc: *const DXGI_SWAP_CHAIN_DESC,
ppSwapChain: *mut *mut IDXGISwapChain,
ppDevice: *mut *mut ID3D10Device,
) -> HRESULT;
}
DEFINE_GUID!{IID_ID3D10BlendState1,
0xedad8d99, 0x8a35, 0x4d6d, 0x85, 0x66, 0x2e, 0xa2, 0x76, 0xcd, 0xe1, 0x61}
DEFINE_GUID!{IID_ID3D10ShaderResourceView1,
Expand Down
198 changes: 198 additions & 0 deletions src/um/d3d10_1shader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,203 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
// All files in the project carrying such notice may not be copied, modified, or distributed
// except according to those terms.
use shared::minwindef::{BOOL, FLOAT, UINT};
use um::d3d10::D3D10_PRIMITIVE;
use um::d3d10shader::{
D3D10_SHADER_DESC, D3D10_SHADER_INPUT_BIND_DESC, D3D10_SHADER_VARIABLE_CLASS,
D3D10_SHADER_VARIABLE_TYPE, D3D10_SIGNATURE_PARAMETER_DESC, ID3D10ShaderReflection,
ID3D10ShaderReflectionConstantBuffer, ID3D10ShaderReflectionVariable,
ID3D10ShaderReflectionVtbl
};
use um::winnt::{INT, LPCSTR};
ENUM!{enum D3D10_SHADER_DEBUG_REGTYPE {
D3D10_SHADER_DEBUG_REG_INPUT,
D3D10_SHADER_DEBUG_REG_OUTPUT,
D3D10_SHADER_DEBUG_REG_CBUFFER,
D3D10_SHADER_DEBUG_REG_TBUFFER,
D3D10_SHADER_DEBUG_REG_TEMP,
D3D10_SHADER_DEBUG_REG_TEMPARRAY,
D3D10_SHADER_DEBUG_REG_TEXTURE,
D3D10_SHADER_DEBUG_REG_SAMPLER,
D3D10_SHADER_DEBUG_REG_IMMEDIATECBUFFER,
D3D10_SHADER_DEBUG_REG_LITERAL,
D3D10_SHADER_DEBUG_REG_UNUSED,
D3D11_SHADER_DEBUG_REG_INTERFACE_POINTERS,
D3D11_SHADER_DEBUG_REG_UAV,
D3D10_SHADER_DEBUG_REG_FORCE_DWORD = 0x7fffffff,
}}
ENUM!{enum D3D10_SHADER_DEBUG_SCOPETYPE {
D3D10_SHADER_DEBUG_SCOPE_GLOBAL,
D3D10_SHADER_DEBUG_SCOPE_BLOCK,
D3D10_SHADER_DEBUG_SCOPE_FORLOOP,
D3D10_SHADER_DEBUG_SCOPE_STRUCT,
D3D10_SHADER_DEBUG_SCOPE_FUNC_PARAMS,
D3D10_SHADER_DEBUG_SCOPE_STATEBLOCK,
D3D10_SHADER_DEBUG_SCOPE_NAMESPACE,
D3D10_SHADER_DEBUG_SCOPE_ANNOTATION,
D3D10_SHADER_DEBUG_SCOPE_FORCE_DWORD = 0x7fffffff,
}}
ENUM!{enum D3D10_SHADER_DEBUG_VARTYPE {
D3D10_SHADER_DEBUG_VAR_VARIABLE,
D3D10_SHADER_DEBUG_VAR_FUNCTION,
D3D10_SHADER_DEBUG_VAR_FORCE_DWORD = 0x7fffffff,
}}
STRUCT!{struct D3D10_SHADER_DEBUG_TOKEN_INFO {
File: UINT,
Line: UINT,
Column: UINT,
TokenLength: UINT,
TokenId: UINT,
}}
STRUCT!{struct D3D10_SHADER_DEBUG_VAR_INFO {
TokenId: UINT,
Type: D3D10_SHADER_VARIABLE_TYPE,
Register: UINT,
Component: UINT,
ScopeVar: UINT,
ScopeVarOffset: UINT,
}}
STRUCT!{struct D3D10_SHADER_DEBUG_INPUT_INFO {
Var: UINT,
InitialRegisterSet: D3D10_SHADER_DEBUG_REGTYPE,
InitialBank: UINT,
InitialRegister: UINT,
InitialComponent: UINT,
InitialValue: UINT,
}}
STRUCT!{struct D3D10_SHADER_DEBUG_SCOPEVAR_INFO {
TokenId: UINT,
VarType: D3D10_SHADER_DEBUG_VARTYPE,
Class: D3D10_SHADER_VARIABLE_CLASS,
Rows: UINT,
Columns: UINT,
StructMemberScope: UINT,
uArrayIndices: UINT,
ArrayElements: UINT,
ArrayStrides: UINT,
uVariables: UINT,
uFirstVariable: UINT,
}}
STRUCT!{struct D3D10_SHADER_DEBUG_SCOPE_INFO {
ScopeType: D3D10_SHADER_DEBUG_SCOPETYPE,
Name: UINT,
uNameLen: UINT,
uVariables: UINT,
VariableData: UINT,
}}
STRUCT!{struct D3D10_SHADER_DEBUG_OUTPUTVAR {
Var: UINT,
uValueMin: UINT,
uValueMax: UINT,
iValueMin: INT,
iValueMax: INT,
fValueMin: FLOAT,
fValueMax: FLOAT,
bNaNPossible: BOOL,
bInfPossible: BOOL,
}}
STRUCT!{struct D3D10_SHADER_DEBUG_OUTPUTREG_INFO {
OutputRegisterSet: D3D10_SHADER_DEBUG_REGTYPE,
OutputReg: UINT,
TempArrayReg: UINT,
OutputComponents: [UINT; 4],
OutputVars: [D3D10_SHADER_DEBUG_OUTPUTVAR; 4],
IndexReg: UINT,
IndexComp: UINT,
}}
STRUCT!{struct D3D10_SHADER_DEBUG_INST_INFO {
Id: UINT,
Opcode: UINT,
uOutputs: UINT,
pOutputs: [D3D10_SHADER_DEBUG_OUTPUTREG_INFO; 2],
TokenId: UINT,
NestingLevel: UINT,
Scopes: UINT,
ScopeInfo: UINT,
AccessedVars: UINT,
AccessedVarsInfo: UINT,
}}
STRUCT!{struct D3D10_SHADER_DEBUG_FILE_INFO {
FileName: UINT,
FileNameLen: UINT,
FileData: UINT,
FileLen: UINT,
}}
STRUCT!{struct D3D10_SHADER_DEBUG_INFO {
Size: UINT,
Creator: UINT,
EntrypointName: UINT,
ShaderTarget: UINT,
CompileFlags: UINT,
Files: UINT,
FileInfo: UINT,
Instructions: UINT,
InstructionInfo: UINT,
Variables: UINT,
VariableInfo: UINT,
InputVariables: UINT,
InputVariableInfo: UINT,
Tokens: UINT,
TokenInfo: UINT,
Scopes: UINT,
ScopeInfo: UINT,
ScopeVariables: UINT,
ScopeVariableInfo: UINT,
UintOffset: UINT,
StringOffset: UINT,
}}
RIDL!{#[uuid(0xc3457783, 0xa846, 0x47ce, 0x95, 0x20, 0xce, 0xa6, 0xf6, 0x6e, 0x74, 0x47)]
interface ID3D10ShaderReflection1(ID3D10ShaderReflection1Vtbl):
ID3D10ShaderReflection(ID3D10ShaderReflectionVtbl) {
fn GetDesc(
pDesc: *mut D3D10_SHADER_DESC,
) -> (),
fn GetConstantBufferByIndex(
Index: UINT,
) -> *mut ID3D10ShaderReflectionConstantBuffer,
fn GetConstantBufferByName (
Name: LPCSTR,
) -> *mut ID3D10ShaderReflectionConstantBuffer,
fn GetResourceBindingDesc(
ResourceIndex: UINT,
pDesc: *mut D3D10_SHADER_INPUT_BIND_DESC,
) -> (),
fn GetInputParameterDesc(
ParameterIndex: UINT,
pDesc: *mut D3D10_SIGNATURE_PARAMETER_DESC,
) -> (),
fn GetOutputParameterDesc(
ParameterIndex: UINT,
pDesc: *mut D3D10_SIGNATURE_PARAMETER_DESC,
) -> (),
fn GetVariableByName(
Name: LPCSTR,
) -> *mut ID3D10ShaderReflectionVariable,
fn GetResourceBindingDescByName(
Name: LPCSTR,
pDesc: *mut D3D10_SHADER_INPUT_BIND_DESC,
) -> (),
fn GetMovInstructionCount(
Count: *mut UINT,
) -> (),
fn GetMovcInstructionCount(
Count: *mut UINT,
) -> (),
fn GetConversionInstructionCount(
Count: *mut UINT,
) -> (),
fn GetBitwiseInstructionCount(
Count: *mut UINT,
) -> (),
fn GetGSInputPrimitive(
pPrim: *mut D3D10_PRIMITIVE,
) -> (),
fn IsLevel9Shader(
pbLevel9Shader: *mut BOOL,
) -> (),
fn IsSampleFrequencyShader(
pbSampleFrequency: *mut BOOL,
) -> (),
}}
DEFINE_GUID!{IID_ID3D10ShaderReflection1,
0xc3457783, 0xa846, 0x47ce, 0x95, 0x20, 0xce, 0xa6, 0xf6, 0x6e, 0x74, 0x47}
Loading