File Index Symbol Index

//////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// File: D3D10Effect.h
// Content: D3D10 Stateblock/Effect Types & APIs
//
//////////////////////////////////////////////////////////////////////////////
#ifndef __D3D10EFFECT_H__
#define __D3D10EFFECT_H__
#include <winapifamily.h>
#pragma region Desktop Family
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
#include "d3d10.h"
//////////////////////////////////////////////////////////////////////////////
// File contents:
//
// 1) Stateblock enums, structs, interfaces, flat APIs
// 2) Effect enums, structs, interfaces, flat APIs
//////////////////////////////////////////////////////////////////////////////
//----------------------------------------------------------------------------
// D3D10_DEVICE_STATE_TYPES:
//
// Used in ID3D10StateBlockMask function calls
//
//----------------------------------------------------------------------------
typedef
enum
_D3D10_DEVICE_STATE_TYPES
{
D3D10_DST_SO_BUFFERS
=
1
,
// Single-value state (atomical gets/sets)
D3D10_DST_OM_RENDER_TARGETS
,
// Single-value state (atomical gets/sets)
D3D10_DST_OM_DEPTH_STENCIL_STATE
,
// Single-value state
D3D10_DST_OM_BLEND_STATE
,
// Single-value state
D3D10_DST_VS
,
// Single-value state
D3D10_DST_VS_SAMPLERS
,
// Count: D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT
D3D10_DST_VS_SHADER_RESOURCES
,
// Count: D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT
D3D10_DST_VS_CONSTANT_BUFFERS
,
// Count:
D3D10_DST_GS
,
// Single-value state
D3D10_DST_GS_SAMPLERS
,
// Count: D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT
D3D10_DST_GS_SHADER_RESOURCES
,
// Count: D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT
D3D10_DST_GS_CONSTANT_BUFFERS
,
// Count: D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT
D3D10_DST_PS
,
// Single-value state
D3D10_DST_PS_SAMPLERS
,
// Count: D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT
D3D10_DST_PS_SHADER_RESOURCES
,
// Count: D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT
D3D10_DST_PS_CONSTANT_BUFFERS
,
// Count: D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT
D3D10_DST_IA_VERTEX_BUFFERS
,
// Count: D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT
D3D10_DST_IA_INDEX_BUFFER
,
// Single-value state
D3D10_DST_IA_INPUT_LAYOUT
,
// Single-value state
D3D10_DST_IA_PRIMITIVE_TOPOLOGY
,
// Single-value state
D3D10_DST_RS_VIEWPORTS
,
// Single-value state (atomical gets/sets)
D3D10_DST_RS_SCISSOR_RECTS
,
// Single-value state (atomical gets/sets)
D3D10_DST_RS_RASTERIZER_STATE
,
// Single-value state
D3D10_DST_PREDICATION
,
// Single-value state
}
D3D10_DEVICE_STATE_TYPES
;
//----------------------------------------------------------------------------
// D3D10_DEVICE_STATE_TYPES:
//
// Used in ID3D10StateBlockMask function calls
//
//----------------------------------------------------------------------------
#ifndef D3D10_BYTES_FROM_BITS
#define D3D10_BYTES_FROM_BITS(x) (((x) + 7) / 8) #endif // D3D10_BYTES_FROM_BITS
typedef
struct
_D3D10_STATE_BLOCK_MASK
{
BYTE
VS
;
BYTE
GS
;
BYTE
PS
;
BYTE
IAIndexBuffer
;
BYTE
IAInputLayout
;
BYTE
IAPrimitiveTopology
;
BYTE
OMRenderTargets
;
BYTE
OMDepthStencilState
;
BYTE
OMBlendState
;
BYTE
RSViewports
;
BYTE
RSScissorRects
;
BYTE
RSRasterizerState
;
BYTE
SOBuffers
;
BYTE
Predication
; }
D3D10_STATE_BLOCK_MASK
;
//////////////////////////////////////////////////////////////////////////////
// ID3D10StateBlock //////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// {0803425A-57F5-4dd6-9465-A87570834A08}
#undef INTERFACE
#define INTERFACE ID3D10StateBlock
{ };
#ifdef __cplusplus
extern
"C"
{
#endif //__cplusplus
//----------------------------------------------------------------------------
// D3D10_STATE_BLOCK_MASK and manipulation functions
// -------------------------------------------------
//
// These functions exist to facilitate working with the D3D10_STATE_BLOCK_MASK
// structure.
//
// D3D10_STATE_BLOCK_MASK *pResult or *pMask
// The state block mask to operate on
//
// D3D10_STATE_BLOCK_MASK *pA, *pB
// The source state block masks for the binary union/intersect/difference
// operations.
//
// D3D10_DEVICE_STATE_TYPES StateType
// The specific state type to enable/disable/query
//
// UINT RangeStart, RangeLength, Entry
// The specific bit or range of bits for a given state type to operate on.
// Consult the comments for D3D10_DEVICE_STATE_TYPES and
// D3D10_STATE_BLOCK_MASK for information on the valid bit ranges for
// each state.
//
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
// D3D10CreateStateBlock
// ---------------------
//
// Creates a state block object based on the mask settings specified
// in a D3D10_STATE_BLOCK_MASK structure.
//
// ID3D10Device *pDevice
// The device interface to associate with this state block
//
// D3D10_STATE_BLOCK_MASK *pStateBlockMask
// A bit mask whose settings are used to generate a state block
// object.
//
// ID3D10StateBlock **ppStateBlock
// The resulting state block object. This object will save/restore
// only those pieces of state that were set in the state block
// bit mask
//----------------------------------------------------------------------------
#ifdef __cplusplus
}
#endif //__cplusplus
//----------------------------------------------------------------------------
// D3D10_COMPILE & D3D10_EFFECT flags:
// -------------------------------------
//
// These flags are passed in when creating an effect, and affect
// either compilation behavior or runtime effect behavior
//
// D3D10_EFFECT_COMPILE_CHILD_EFFECT
// Compile this .fx file to a child effect. Child effects have no initializers
// for any shared values as these are initialied in the master effect (pool).
//
// D3D10_EFFECT_COMPILE_ALLOW_SLOW_OPS
// By default, performance mode is enabled. Performance mode disallows
// mutable state objects by preventing non-literal expressions from appearing in
// state object definitions. Specifying this flag will disable the mode and allow
// for mutable state objects.
//
// D3D10_EFFECT_SINGLE_THREADED
// Do not attempt to synchronize with other threads loading effects into the
// same pool.
//
//----------------------------------------------------------------------------
#define D3D10_EFFECT_COMPILE_CHILD_EFFECT (1 << 0)
#define D3D10_EFFECT_COMPILE_ALLOW_SLOW_OPS (1 << 1)
#define D3D10_EFFECT_SINGLE_THREADED (1 << 3)
//----------------------------------------------------------------------------
// D3D10_EFFECT_VARIABLE flags:
// ----------------------------
//
// These flags describe an effect variable (global or annotation),
// and are returned in D3D10_EFFECT_VARIABLE_DESC::Flags.
//
// D3D10_EFFECT_VARIABLE_POOLED
// Indicates that the this variable or constant buffer resides
// in an effect pool. If this flag is not set, then the variable resides
// in a standalone effect (if ID3D10Effect::GetPool returns NULL)
// or a child effect (if ID3D10Effect::GetPool returns non-NULL)
//
// D3D10_EFFECT_VARIABLE_ANNOTATION
// Indicates that this is an annotation on a technique, pass, or global
// variable. Otherwise, this is a global variable. Annotations cannot
// be shared.
//
// D3D10_EFFECT_VARIABLE_EXPLICIT_BIND_POINT
// Indicates that the variable has been explicitly bound using the
// register keyword.
//----------------------------------------------------------------------------
#define D3D10_EFFECT_VARIABLE_POOLED (1 << 0)
#define D3D10_EFFECT_VARIABLE_ANNOTATION (1 << 1)
#define D3D10_EFFECT_VARIABLE_EXPLICIT_BIND_POINT (1 << 2)
//////////////////////////////////////////////////////////////////////////////
// ID3D10EffectType //////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//----------------------------------------------------------------------------
// D3D10_EFFECT_TYPE_DESC:
//
// Retrieved by ID3D10EffectType::GetDesc()
//----------------------------------------------------------------------------
typedef
struct
_D3D10_EFFECT_TYPE_DESC
{
LPCSTR
TypeName
;
// Name of the type
// (e.g. "float4" or "MyStruct")
D3D10_SHADER_VARIABLE_CLASS
Class
;
// (e.g. scalar, vector, object, etc.)
D3D10_SHADER_VARIABLE_TYPE
Type
;
// (e.g. float, texture, vertexshader, etc.)
UINT
Elements
;
// Number of elements in this type
// (0 if not an array)
UINT
Members
;
// Number of members
// (0 if not a structure)
UINT
Rows
;
// Number of rows in this type
// (0 if not a numeric primitive)
UINT
Columns
;
// Number of columns in this type
// (0 if not a numeric primitive)
UINT
PackedSize
;
// Number of bytes required to represent
// this data type, when tightly packed
UINT
UnpackedSize
;
// Number of bytes occupied by this data
// type, when laid out in a constant buffer
UINT
Stride
;
// Number of bytes to seek between elements,
// when laid out in a constant buffer
}
D3D10_EFFECT_TYPE_DESC
;
// {4E9E1DDC-CD9D-4772-A837-00180B9B88FD}
#undef INTERFACE
#define INTERFACE ID3D10EffectType
{ };
//////////////////////////////////////////////////////////////////////////////
// ID3D10EffectVariable //////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//----------------------------------------------------------------------------
// D3D10_EFFECT_VARIABLE_DESC:
//
// Retrieved by ID3D10EffectVariable::GetDesc()
//----------------------------------------------------------------------------
typedef
struct
_D3D10_EFFECT_VARIABLE_DESC
{
LPCSTR
Name
;
// Name of this variable, annotation,
// or structure member
LPCSTR
Semantic
;
// Semantic string of this variable
// or structure member (NULL for
// annotations or if not present)
UINT
Flags
;
// D3D10_EFFECT_VARIABLE_* flags
UINT
Annotations
;
// Number of annotations on this variable
// (always 0 for annotations)
UINT
BufferOffset
;
// Offset into containing cbuffer or tbuffer
// (always 0 for annotations or variables
// not in constant buffers)
UINT
ExplicitBindPoint
;
// Used if the variable has been explicitly bound
// using the register keyword. Check Flags for
// D3D10_EFFECT_VARIABLE_EXPLICIT_BIND_POINT;
}
D3D10_EFFECT_VARIABLE_DESC
;
// {AE897105-00E6-45bf-BB8E-281DD6DB8E1B}
#undef INTERFACE
#define INTERFACE ID3D10EffectVariable
// Forward defines
{ };
//////////////////////////////////////////////////////////////////////////////
// ID3D10EffectScalarVariable ////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// {00E48F7B-D2C8-49e8-A86C-022DEE53431F}
#undef INTERFACE
#define INTERFACE ID3D10EffectScalarVariable
{ };
//////////////////////////////////////////////////////////////////////////////
// ID3D10EffectVectorVariable ////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// {62B98C44-1F82-4c67-BCD0-72CF8F217E81}
#undef INTERFACE
#define INTERFACE ID3D10EffectVectorVariable
{ };
//////////////////////////////////////////////////////////////////////////////
// ID3D10EffectMatrixVariable ////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// {50666C24-B82F-4eed-A172-5B6E7E8522E0}
#undef INTERFACE
#define INTERFACE ID3D10EffectMatrixVariable
{ };
//////////////////////////////////////////////////////////////////////////////
// ID3D10EffectStringVariable ////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// {71417501-8DF9-4e0a-A78A-255F9756BAFF}
#undef INTERFACE
#define INTERFACE ID3D10EffectStringVariable
{ };
//////////////////////////////////////////////////////////////////////////////
// ID3D10EffectShaderResourceVariable ////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// {C0A7157B-D872-4b1d-8073-EFC2ACD4B1FC}
#undef INTERFACE
#define INTERFACE ID3D10EffectShaderResourceVariable
{ };
//////////////////////////////////////////////////////////////////////////////
// ID3D10EffectRenderTargetViewVariable //////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// {28CA0CC3-C2C9-40bb-B57F-67B737122B17}
#undef INTERFACE
#define INTERFACE ID3D10EffectRenderTargetViewVariable
{ };
//////////////////////////////////////////////////////////////////////////////
// ID3D10EffectDepthStencilViewVariable //////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// {3E02C918-CC79-4985-B622-2D92AD701623}
#undef INTERFACE
#define INTERFACE ID3D10EffectDepthStencilViewVariable
{ };
//////////////////////////////////////////////////////////////////////////////
// ID3D10EffectConstantBuffer ////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// {56648F4D-CC8B-4444-A5AD-B5A3D76E91B3}
#undef INTERFACE
#define INTERFACE ID3D10EffectConstantBuffer
{ };
//////////////////////////////////////////////////////////////////////////////
// ID3D10EffectShaderVariable ////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//----------------------------------------------------------------------------
// D3D10_EFFECT_SHADER_DESC:
//
// Retrieved by ID3D10EffectShaderVariable::GetShaderDesc()
//----------------------------------------------------------------------------
typedef
struct
_D3D10_EFFECT_SHADER_DESC
{
// valid on VS and GS only
BOOL
IsInline
;
// Is this an anonymous shader variable
// resulting from an inline shader assignment?
// -- The following fields are not valid after Optimize() --
UINT
BytecodeLength
;
LPCSTR
SODecl
;
// Stream out declaration string (for GS with SO)
UINT
NumInputSignatureEntries
;
// Number of entries in the input signature
UINT
NumOutputSignatureEntries
;
// Number of entries in the output signature
}
D3D10_EFFECT_SHADER_DESC
;
// {80849279-C799-4797-8C33-0407A07D9E06}
#undef INTERFACE
#define INTERFACE ID3D10EffectShaderVariable
{ };
//////////////////////////////////////////////////////////////////////////////
// ID3D10EffectBlendVariable /////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// {1FCD2294-DF6D-4eae-86B3-0E9160CFB07B}
#undef INTERFACE
#define INTERFACE ID3D10EffectBlendVariable
{ };
//////////////////////////////////////////////////////////////////////////////
// ID3D10EffectDepthStencilVariable //////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// {AF482368-330A-46a5-9A5C-01C71AF24C8D}
#undef INTERFACE
#define INTERFACE ID3D10EffectDepthStencilVariable
{ };
//////////////////////////////////////////////////////////////////////////////
// ID3D10EffectRasterizerVariable ////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// {21AF9F0E-4D94-4ea9-9785-2CB76B8C0B34}
#undef INTERFACE
#define INTERFACE ID3D10EffectRasterizerVariable
{ };
//////////////////////////////////////////////////////////////////////////////
// ID3D10EffectSamplerVariable ///////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// {6530D5C7-07E9-4271-A418-E7CE4BD1E480}
#undef INTERFACE
#define INTERFACE ID3D10EffectSamplerVariable
{ };
//////////////////////////////////////////////////////////////////////////////
// ID3D10EffectPass //////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//----------------------------------------------------------------------------
// D3D10_PASS_DESC:
//
// Retrieved by ID3D10EffectPass::GetDesc()
//----------------------------------------------------------------------------
typedef
struct
_D3D10_PASS_DESC
{
LPCSTR
Name
;
// Name of this pass (NULL if not anonymous)
UINT
Annotations
;
// Number of annotations on this pass
BYTE
*
pIAInputSignature
;
// Signature from VS or GS (if there is no VS)
// or NULL if neither exists
SIZE_T
IAInputSignatureSize
;
// Singature size in bytes
UINT
StencilRef
;
// Specified in SetDepthStencilState()
UINT
SampleMask
;
// Specified in SetBlendState()
FLOAT
BlendFactor
[
4
];
// Specified in SetBlendState()
}
D3D10_PASS_DESC
;
//----------------------------------------------------------------------------
// D3D10_PASS_SHADER_DESC:
//
// Retrieved by ID3D10EffectPass::Get**ShaderDesc()
//----------------------------------------------------------------------------
typedef
struct
_D3D10_PASS_SHADER_DESC
{
ID3D10EffectShaderVariable
*
pShaderVariable
;
// The variable that this shader came from.
// If this is an inline shader assignment,
// the returned interface will be an
// anonymous shader variable, which is
// not retrievable any other way. It's
// name in the variable description will
// be "$Anonymous".
// If there is no assignment of this type in
// the pass block, pShaderVariable != NULL,
// but pShaderVariable->IsValid() == FALSE.
UINT
ShaderIndex
;
// The element of pShaderVariable (if an array)
// or 0 if not applicable
}
D3D10_PASS_SHADER_DESC
;
// {5CFBEB89-1A06-46e0-B282-E3F9BFA36A54}
#undef INTERFACE
#define INTERFACE ID3D10EffectPass
{ };
//////////////////////////////////////////////////////////////////////////////
// ID3D10EffectTechnique /////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//----------------------------------------------------------------------------
// D3D10_TECHNIQUE_DESC:
//
// Retrieved by ID3D10EffectTechnique::GetDesc()
//----------------------------------------------------------------------------
typedef
struct
_D3D10_TECHNIQUE_DESC
{
LPCSTR
Name
;
// Name of this technique (NULL if not anonymous)
UINT
Passes
;
// Number of passes contained within
UINT
Annotations
;
// Number of annotations on this technique
}
D3D10_TECHNIQUE_DESC
;
// {DB122CE8-D1C9-4292-B237-24ED3DE8B175}
#undef INTERFACE
#define INTERFACE ID3D10EffectTechnique
{ };
//////////////////////////////////////////////////////////////////////////////
// ID3D10Effect //////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//----------------------------------------------------------------------------
// D3D10_EFFECT_DESC:
//
// Retrieved by ID3D10Effect::GetDesc()
//----------------------------------------------------------------------------
typedef
struct
_D3D10_EFFECT_DESC
{
BOOL
IsChildEffect
;
// TRUE if this is a child effect,
// FALSE if this is standalone or an effect pool.
UINT
ConstantBuffers
;
// Number of constant buffers in this effect,
// excluding the effect pool.
UINT
SharedConstantBuffers
;
// Number of constant buffers shared in this
// effect's pool.
UINT
GlobalVariables
;
// Number of global variables in this effect,
// excluding the effect pool.
UINT
SharedGlobalVariables
;
// Number of global variables shared in this
// effect's pool.
UINT
Techniques
;
// Number of techniques in this effect,
// excluding the effect pool.
}
D3D10_EFFECT_DESC
;
// {51B0CA8B-EC0B-4519-870D-8EE1CB5017C7}
#undef INTERFACE
#define INTERFACE ID3D10Effect
{
// IUnknown
// Managing D3D Device
// New Reflection APIs
};
//////////////////////////////////////////////////////////////////////////////
// ID3D10EffectPool //////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// {9537AB04-3250-412e-8213-FCD2F8677933}
#undef INTERFACE
#define INTERFACE ID3D10EffectPool
{
// IUnknown
// No public methods
};
//////////////////////////////////////////////////////////////////////////////
// APIs //////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
#ifdef __cplusplus
extern
"C"
{
#endif //__cplusplus
//----------------------------------------------------------------------------
// D3D10CreateEffectFromXXXX:
// --------------------------
// Creates an effect from a binary effect or file
//
// Parameters:
//
// [in]
//
//
// pData
// Blob of effect data, either ASCII (uncompiled, for D3D10CompileEffectFromMemory) or binary (compiled, for D3D10CreateEffect*)
// DataLength
// Length of the data blob
//
// pSrcFileName
// Name of the ASCII Effect file pData was obtained from
//
// pDefines
// Optional NULL-terminated array of preprocessor macro definitions.
// pInclude
// Optional interface pointer to use for handling #include directives.
// If this parameter is NULL, #includes will be honored when compiling
// from file, and will error when compiling from resource or memory.
// HLSLFlags
// Compilation flags pertaining to shaders and data types, honored by
// the HLSL compiler
// FXFlags
// Compilation flags pertaining to Effect compilation, honored
// by the Effect compiler
// pDevice
// Pointer to the D3D10 device on which to create Effect resources
// pEffectPool
// Pointer to an Effect pool to share variables with or NULL
//
// [out]
//
// ppEffect
// Address of the newly created Effect interface
// ppEffectPool
// Address of the newly created Effect pool interface
// ppErrors
// If non-NULL, address of a buffer with error messages that occurred
// during parsing or compilation
//
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
// D3D10DisassembleEffect:
// -----------------------
// Takes an effect interface, and returns a buffer containing text assembly.
//
// Parameters:
// pEffect
// Pointer to the runtime effect interface.
// EnableColorCode
// Emit HTML tags for color coding the output?
// ppDisassembly
// Returns a buffer containing the disassembled effect.
//----------------------------------------------------------------------------
#ifdef __cplusplus
}
#endif //__cplusplus
#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */
#pragma endregion
#endif //__D3D10EFFECT_H__