d3d11.Device
The Device class represents the actual physical (or software) device which
will be used.
Methods
-
class Device
-
Device(Window window[, drivertype, adapterindex=0, rtformat, dsformat, multisampling=(1, 0)]) → Device
| Parameters: |
- window – The Window used by the Device. Can be None if no on-screen rendering will be required.
- drivertype – One of the Device driver type-values. Default is DRIVER_TYPE_HARDWARE.
- adapterindex – The index of the adapter (usually a GPU) which will be used. You can
use d3d11.enumAdapters() to enumerate all available adapters.
- rtformat – Format for the default render target texture. Default is DXGI_FORMAT_R8G8B8A8_UNORM.
- dsformat – Format for the default depth stencil texture. Default is DXGI_FORMAT_D24_UNORM_S8_UINT.
- multisampling – Count and quality of samples when multisampling. (1, 0) means no multisampling.
|
The constructor creates a new device.
-
checkMultisampleQualityLevels(format, count) → int
| Parameters: |
- format – A Format value.
- count – Required multisampling sample count.
|
Checks support for multisampling, returns the supported quality level.
-
createBlendState(dict values) → DeviceState
| Parameters: |
- values – A dictionary with
|
Creates a new DeviceState with a blend state. Use setState() to set
the returned object.
#Creates a default state.
defaultBlendState = device.createBlendState({})
#Create two state that disable and enable alpha blending from the first render target.
disableAlphaBlendState = device.createBlendState({"BlendEnable[0]" : False})
enableAlphaBlendState = device.createBlendState({"BlendEnable[0]" : True})
#Create a depth stencil state.
depthStencilState = device.createDepthStencilState({"StencilEnable" : True,
"BackFace.StencilFailOp" : STENCIL_OP_KEEP})
-
createDepthStencilState(dict values) → DeviceState
Creates a new DeviceState with a depth stencil state. See createBlendState().
-
createRasterizerState(dict values) → DeviceState
Creates a new DeviceState with a rasterizer state. See createBlendState().
-
createSamplerState(dict values) → DeviceState
Creates a new DeviceState with a sampler state. See createBlendState().
-
dispatch(int xcount, int ycount, int zcount) → None
| Parameters: |
- xcount – The number of thread groups dispatched in x-direction.
- ycount – The number of thread groups dispatched in y-direction.
- zcount – The number of thread groups dispatched in z-direction.
|
Execute a command list from a thread group, used with compute shaders.
-
draw(int vertexcount, int startlocation) → None
| Parameters: |
- vertexcount – Number of vertices to draw.
- startlocation – The index of the first vertex to be drawn.
|
Draws vertices.
-
drawAuto() → None
Draw geometry of an unknown size.
MSDN - DrawAuto()
-
drawInstanced(int vertexcount, int instancecount, int startvertex, int startinstance) → None
| Parameters: |
- vertexcount – How many vertices per instance.
- instancecount – How many instances to draw.
- startvertex – Index of the first vertex.
- startinstance – A value added to each index before reading per-instance data from a vertex buffer.
|
Draws instanced vertices.
-
drawIndexed(int indexcount, int startindex, int basevertex) → None
| Parameters: |
- indexcount – Number of indices to draw.
- startindex – The index of the first index to be used.
- basevertex – The index of the first vertex to be drawn.
|
Draws indexed vertices.
-
drawIndexedInstanced(int indexcount, int instancecount, int startindex, int startvertex, int startinstance) → None
| Parameters: |
- indexcount – Number of indices read from the index buffer for each instance.
- instancecount – Number of instances to draw.
- startindex – The location of the first index read from the index buffer.
- startvertex – A value added to each index before reading a vertex from the vertex buffer.
- startinstance – A value added to each index before reading per-instance data from a vertex buffer.
|
Draws indexed and instanced vertices.
-
flush() → None
Flushes all pending operations. There is usually no need to call this.
-
getDefaultDS() → Texture
Note
Internal data, call the release() method of the returned object as soon as possible.
Returns the default depth stencil Texture or None.
-
getDefaultDSView() → View
Note
Internal data, call the release() method of the returned object as soon as possible.
Returns the default depth stencil View or None.
-
getDefaultRT() → Texture
Note
Internal data, call the release() method of the returned object as soon as possible.
Returns the default render target Texture or None.
-
getDefaultRTView() → View
Note
Internal data, call the release() method of the returned object as soon as possible.
Returns the default render target View or None.
-
getFeatureLevel() → int
Returns the feature level of the device. You can use d3d11x.featureLevel() to get
more representable value.
-
getDisplayModes(format=0) → list
Returns all valid display modes (width, height, format) for the device. If format
is 0 current backbuffer format is used.