28 #ifndef __D3D11RENDERSYSTEM_H__
29 #define __D3D11RENDERSYSTEM_H__
40 class D3D11DriverList;
187 ID3D11ShaderResourceView *
pTex;
279 bool twoSidedOperation =
false);
324 void _setDepthBias(
float constantBias,
float slopeScaleBias);
327 Matrix4& dest,
bool forGpuProgram =
false);
329 Matrix4& dest,
bool forGpuProgram =
false);
331 Real farPlane,
Matrix4& dest,
bool forGpuProgram =
false);
333 Matrix4& dest,
bool forGpuProgram =
false);
362 void setScissorTest(
bool enabled,
size_t left = 0,
size_t top = 0,
size_t right = 800,
size_t bottom = 600);
365 Real depth = 1.0f,
unsigned short stencil = 0);
const String & getName(void) const
Returns the name of the rendering system.
vector< Plane >::type PlaneList
void _setDepthBufferFunction(CompareFunction func=CMPF_LESS_EQUAL)
Sets the comparison function for the depth buffer check.
A 'canvas' which can receive the results of a rendering operation.
D3D11HLSLProgram * mBoundVertexProgram
RenderTexture * createRenderTexture(const String &name, unsigned int width, unsigned int height, TextureType texType=TEX_TYPE_2D, PixelFormat internalFormat=PF_X8R8G8B8, const NameValuePairList *miscParams=0)
void _setDepthBufferParams(bool depthTest=true, bool depthWrite=true, CompareFunction depthFunction=CMPF_LESS_EQUAL)
Sets the mode of operation for depth buffer tests from this point onwards.
void _setTextureMatrix(size_t unit, const Matrix4 &xform)
Sets the texture coordinate transformation matrix for a texture unit.
Real getHorizontalTexelOffset(void)
Returns the horizontal texel offset value required for mapping texel origins to pixel origins in this...
virtual void initConfigOptions(void)
D3D11HLSLProgramFactory * mHLSLProgramFactory
D3D11HLSLProgram * mBoundComputeProgram
void _setTextureAddressingMode(size_t stage, const TextureUnitState::UVWAddressingMode &uvw)
Sets the texture addressing mode for a texture unit.
void _setWorldMatrix(const Matrix4 &m)
Sets the world transform matrix.
void _makeProjectionMatrix(const Radian &fovy, Real aspect, Real nearPlane, Real farPlane, Matrix4 &dest, bool forGpuProgram=false)
Builds a perspective projection matrix suitable for this render system.
void _setPolygonMode(PolygonMode level)
Sets how to rasterise triangles, as points, wireframe or solid polys.
Texture addressing mode for each texture coordinate.
void _setTextureBlendMode(size_t unit, const LayerBlendModeEx &bm)
Sets the texture blend modes from a TextureUnitState record.
void clearFrameBuffer(unsigned int buffers, const ColourValue &colour=ColourValue::Black, Real depth=1.0f, unsigned short stencil=0)
Clears one or more frame buffers on the active render target.
ConfigOptionMap & getConfigOptions(void)
Returns the details of this API's configuration options.
VertexElementType
Vertex element type, used to identify the base types of the vertex contents.
void unregisterThread()
Unregister an additional thread which may make calls to rendersystem-related objects.
D3D11_SAMPLER_DESC samplerDesc
void _setAlphaRejectSettings(CompareFunction func, unsigned char value, bool alphaToCoverage)
Sets the global alpha rejection approach for future renders.
bool mSceneAlphaToCoverage
size_t coordIndex
which texCoordIndex to use
void _setTextureBorderColour(size_t stage, const ColourValue &colour)
Sets the texture border colour for a texture unit.
Leave the stencil buffer unchanged.
Real getVerticalTexelOffset(void)
Returns the vertical texel offset value required for mapping texel origins to pixel origins in this r...
void convertVertexShaderCaps(RenderSystemCapabilities *rsc) const
D3D11DriverList * mDriverList
List of D3D drivers installed (video cards)
void setClipPlane(ushort index, Real A, Real B, Real C, Real D)
void _setProjectionMatrix(const Matrix4 &m)
Sets the projection transform matrix.
HINSTANCE mhInstance
instance
void _convertProjectionMatrix(const Matrix4 &matrix, Matrix4 &dest, bool forGpuProgram=false)
Converts a uniform projection matrix to suitable for this render system.
void _setRenderTarget(RenderTarget *target)
Set current render target to target, enabling its GL context if needed.
2D texture, used in combination with 2D texture coordinates (default)
bool mBasicStatesInitialised
ID3D11ClassInstance * mClassInstances[6][8]
Real getMaximumDepthInputValue(void)
Gets the maximum (farthest) depth value to be used when rendering using identity transforms.
void bindGpuProgram(GpuProgram *prg)
See RenderSystem.
void convertDomainShaderCaps(RenderSystemCapabilities *rsc) const
Class representing colour.
float Real
Software floating point type.
UINT mNumClassInstances[6]
static const ColourValue Black
32-bit pixel format, 8 bits for red, 8 bits for green, 8 bits for blue like PF_A8R8G8B8, but alpha will get discarded
D3D11_DEPTH_STENCIL_DESC mDepthStencilDesc
D3D11DriverList * getDirect3DDrivers(void)
structure holding texture unit settings for every stage
D3D11Driver * mActiveD3DDriver
Currently active driver.
virtual bool hasAnisotropicMipMapFilter() const
Determines if the system has anisotropic mip map filter support.
D3D11HLSLProgram * _getBoundVertexProgram() const
void convertComputeShaderCaps(RenderSystemCapabilities *rsc) const
void _setViewport(Viewport *vp)
Sets the provided viewport as the active one for future rendering operations.
PixelFormat
The pixel format used for images, textures, and render surfaces.
ID3D11ShaderResourceView * mBoundTextures[OGRE_MAX_TEXTURE_LAYERS]
void getCustomAttribute(const String &name, void *pData)
Gets a custom (maybe platform-specific) attribute.
RenderWindow * _createRenderWindow(const String &name, unsigned int width, unsigned int height, bool fullScreen, const NameValuePairList *miscParams=0)
Creates a new rendering window.
void setAmbientLight(float r, float g, float b)
Sets the colour & strength of the ambient (global directionless) light in the world.
bool _checkTextureFilteringSupported(TextureType ttype, PixelFormat format, int usage)
Check whether or not filtering is supported for the precise texture format requested with the given u...
const Frustum * frustum
Frustum, used if the above is projection.
RenderWindow * _initialise(bool autoCreateWindow, const String &windowTitle="OGRE Render Window")
Start up the renderer using the settings selected (Or the defaults if none have been selected)...
void _setTextureUnitFiltering(size_t unit, FilterType ftype, FilterOptions filter)
Sets a single filter for a given texture unit.
virtual MultiRenderTarget * createMultiRenderTarget(const String &name)
Create a MultiRenderTarget, which is a render target that renders to multiple RenderTextures at once...
An abstraction of a viewport, i.e.
ID3D11BlendState * mBoundBlendState
void _setPointSpritesEnabled(bool enabled)
Sets whether or not rendering points using OT_POINT_LIST will render point sprites (textured quads) o...
RenderSystemCapabilities * createRenderSystemCapabilities() const
Internal method for populating the capabilities structure.
virtual RenderTarget * detachRenderTarget(const String &name)
Detaches the render target with the passed name from the render system and returns a pointer to it...
SecondaryWindowList mSecondaryWindows
Defines a plane in 3D space.
Implementation of DirectX11 as a rendering system.
static const ColourValue White
void determineFSAASettings(uint fsaa, const String &fsaaHint, DXGI_FORMAT format, DXGI_SAMPLE_DESC *outFSAASettings)
unsigned char mSceneAlphaRejectValue
TextureType type
the type of the texture
D3D_FEATURE_LEVEL mFeatureLevel
void _setDepthBufferWriteEnabled(bool enabled=true)
Sets whether or not the depth buffer is updated after a pixel write.
void setLightingEnabled(bool enabled)
Sets whether or not dynamic lighting is enabled.
D3D11HLSLProgram * _getBoundTesselationDomainProgram() const
D3D_FEATURE_LEVEL mMaxRequestedFeatureLevel
D3D11GpuProgramManager * mGpuProgramManager
Class encapsulating a standard 4x4 homogeneous matrix.
void _setSceneBlending(SceneBlendFactor sourceFactor, SceneBlendFactor destFactor, SceneBlendOperation op=SBO_ADD)
Sets the global blending factors for combining subsequent renders with the existing frame contents...
DWORD _getCurrentAnisotropy(size_t unit)
return anisotropy level
void _setDepthBufferCheckEnabled(bool enabled=true)
Sets whether or not the depth buffer check is performed before a pixel write.
D3D11HLSLProgram * _getBoundTesselationHullProgram() const
void _beginFrame(void)
Signifies the beginning of a frame, i.e.
This class declares the format of a set of vertex inputs, which can be issued to the rendering API th...
VertexElementType getColourVertexElementType(void) const
Get the native VertexElementType for a compact 32-bit colour value for this rendersystem.
virtual void markProfileEvent(const String &eventName)
Marks an instantaneous event for graphics profilers.
#define OGRE_MAX_TEXTURE_LAYERS
Define max number of texture layers allowed per pass on any card.
CullingMode
Hardware culling modes based on vertex winding.
void setNormaliseNormals(bool normalise)
Sets whether or not normals are to be automatically normalised.
unsigned int getDisplayMonitorCount() const
Gets the number of display monitors.
Real getMinimumDepthInputValue(void)
Gets the minimum (closest) depth value to be used when rendering using identity transforms.
int TrackVertexColourType
An enumeration describing which material properties should track the vertex colours.
void destroyRenderTarget(const String &name)
Destroys a render target of any sort.
void _setVertexTexture(size_t unit, const TexturePtr &tex)
Binds a texture to a vertex sampler.
void _setTexture(size_t unit, bool enabled, const TexturePtr &texPtr)
Sets the texture to bind to a given texture unit.
void convertPixelShaderCaps(RenderSystemCapabilities *rsc) const
Class which manages blending of both colour and alpha components.
HardwareOcclusionQuery * createHardwareOcclusionQuery(void)
Create an object for performing hardware occlusion queries.
Defines the functionality of a 3D API.
bool checkVertexTextureFormats(void)
void setScissorTest(bool enabled, size_t left=0, size_t top=0, size_t right=800, size_t bottom=600)
Sets the 'scissor region' i.e.
std::map< String, ID3D11ClassInstance * >::iterator ClassInstanceIterator
void refreshD3DSettings(void)
D3D11HLSLProgram * mBoundTesselationHullProgram
D3D11RenderWindowBase * mPrimaryWindow
Primary window, the one used to create the device.
map< String, ConfigOption >::type ConfigOptionMap
This class represents a RenderTarget that renders to a Texture.
map< String, String >::type NameValuePairList
Name / value parameter pair (first = name, second = value)
void setSubroutine(GpuProgramType gptype, unsigned int slotIndex, const String &subroutineName)
Specialization of HighLevelGpuProgram to provide support for D3D11 High-Level Shader Language (HLSL)...
TextureType
Enum identifying the texture type.
CompareFunction
Comparison functions used for the depth/stencil buffer operations and others.
TexCoordCalcMethod
Enum describing the ways to generate texture coordinates.
bool _getDepthBufferCheckEnabled(void)
void _useLights(const LightList &lights, unsigned short limit)
Tells the rendersystem to use the attached set of lights (and no others) up to the number specified (...
String validateConfigOptions(void)
Validates the options set for the rendering system, returning a message if there are problems...
void initialiseFromRenderSystemCapabilities(RenderSystemCapabilities *caps, RenderTarget *primary)
See RenderSystem definition.
TexCoordCalcMethod autoTexCoordType
type of auto tex. calc. used
void _makeOrthoMatrix(const Radian &fovy, Real aspect, Real nearPlane, Real farPlane, Matrix4 &dest, bool forGpuProgram=false)
Builds an orthographic projection matrix suitable for this render system.
CompareFunction mSceneAlphaRejectFunc
D3D11HLSLProgram * _getBoundGeometryProgram() const
An abstract class that contains a depth/stencil buffer.
DepthBuffer * _addManualDepthBuffer(ID3D11DepthStencilView *depthSurface, uint32 width, uint32 height, uint32 fsaa, uint32 fsaaQuality)
This function is meant to add Depth Buffers to the pool that aren't released when the DepthBuffer is ...
void refreshFSAAOptions(void)
void _setTextureUnitCompareEnabled(size_t unit, bool compare)
Sets whether the compare func is enabled or not for this texture unit.
void shutdown()
Shutdown the renderer and cleanup resources.
GpuProgramType
Enumerates the types of programs which can run on the GPU.
singleton class for storing the capabilities of the graphics card.
ID3D11DepthStencilState * mBoundDepthStencilState
void bindGpuProgramPassIterationParameters(GpuProgramType gptype)
See RenderSystem.
void postExtraThreadsStarted()
size_t mBoundSamplerStatesCount
bool _checkMultiSampleQuality(UINT SampleCount, UINT *outQuality, DXGI_FORMAT format)
check if a FSAA is supported
D3D11HLSLProgram * mBoundFragmentProgram
void _setSurfaceParams(const ColourValue &ambient, const ColourValue &diffuse, const ColourValue &specular, const ColourValue &emissive, Real shininess, TrackVertexColourType tracking)
Sets the surface properties to be used for future rendering.
void initInputDevices(void)
size_t mLastVertexSourceCount
void setStencilBufferParams(CompareFunction func=CMPF_ALWAYS_PASS, uint32 refValue=0, uint32 compareMask=0xFFFFFFFF, uint32 writeMask=0xFFFFFFFF, StencilOperation stencilFailOp=SOP_KEEP, StencilOperation depthFailOp=SOP_KEEP, StencilOperation passOp=SOP_KEEP, bool twoSidedOperation=false)
Determines if this system supports hardware accelerated stencil buffer.
Records the state of all the vertex buffer bindings required to provide a vertex declaration with the...
void unbindGpuProgram(GpuProgramType gptype)
See RenderSystem.
void _setPointParameters(Real size, bool attenuationEnabled, Real constant, Real linear, Real quadratic, Real minSize, Real maxSize)
Sets the size of points and how they are attenuated with distance.
IDXGIFactory1 IDXGIFactoryN
void convertGeometryShaderCaps(RenderSystemCapabilities *rsc) const
void _setFog(FogMode mode=FOG_NONE, const ColourValue &colour=ColourValue::White, Real expDensity=1.0, Real linearStart=0.0, Real linearEnd=1.0)
Sets the fogging mode for future geometry.
D3D11HardwareBufferManager * mHardwareBufferManager
void bindGpuProgramParameters(GpuProgramType gptype, GpuProgramParametersSharedPtr params, uint16 mask)
See RenderSystem.
void convertHullShaderCaps(RenderSystemCapabilities *rsc) const
void _setRenderTargetViews()
With DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL flag render target views are unbound from us each Present()...
D3D11_RASTERIZER_DESC mRasterizerDesc
D3D11HLSLProgram * mBoundTesselationDomainProgram
D3D11_BLEND_DESC mBlendDesc
void _removeManualDepthBuffer(DepthBuffer *depthBuffer)
Reverts _addManualDepthBuffer actions.
void _setTextureUnitCompareFunction(size_t unit, CompareFunction function)
Sets the compare function to use for a given texture unit.
D3D11HLSLProgram * mBoundGeometryProgram
Defines a program which runs on the GPU such as a vertex or fragment program.
struct Ogre::D3D11RenderSystem::sD3DTextureStageDesc mTexStageDesc[OGRE_MAX_TEXTURE_LAYERS]
void _setDepthBias(float constantBias, float slopeScaleBias)
Sets the depth bias, NB you should use the Material version of this.
SceneBlendFactor
Blending factors for manually blending objects with the scene.
FilterOptions
Filtering options for textures / mipmaps.
ID3D11SamplerState * mBoundSamplerStates[OGRE_MAX_TEXTURE_LAYERS]
void setVertexDeclaration(VertexDeclaration *decl)
Sets the current vertex declaration, ie the source of vertex data.
D3D11Device & _getDevice()
void reinitialise()
Restart the renderer (normally following a change in settings).
D3D11Device mDevice
Direct3D.
void _applyObliqueDepthProjection(Matrix4 &matrix, const Plane &plane, bool forGpuProgram)
Update a perspective projection matrix to use 'oblique depth projection'.
Manages the target rendering window.
This is a abstract class that that provides the interface for the query class for hardware occlusion...
void setShadingType(ShadeOptions so)
Sets the type of light shading required (default = Gouraud).
void _disableTextureUnit(size_t texUnit)
Turns off a texture unit.
D3D11HardwareBufferManagerBase as a Singleton.
ClassInstanceMap mInstanceMap
virtual void endProfileEvent(void)
Ends the currently active GPU profiling event.
void _setViewMatrix(const Matrix4 &m)
Sets the view transform matrix.
void setConfigOption(const String &name, const String &value)
Sets an option for this API.
size_t mBoundTexturesCount
D3D_FEATURE_LEVEL mMinRequestedFeatureLevel
bool mRenderSystemWasInited
StencilOperation
Enum describing the various actions which can be taken on the stencil buffer.
void _setTextureCoordCalculation(size_t unit, TexCoordCalcMethod m, const Frustum *frustum=0)
Sets a method for automatically calculating texture coordinates for a stage.
D3D_FEATURE_LEVEL _getFeatureLevel() const
IDXGIFactoryN * mpDXGIFactory
LayerBlendModeEx layerBlendMode
D3D11HLSLProgram * _getBoundComputeProgram() const
FilterOptions FilterMagnification[OGRE_MAX_TEXTURE_LAYERS]
void _setColourBufferWriteEnabled(bool red, bool green, bool blue, bool alpha)
Sets whether or not colour buffer writing is enabled, and for which channels.
'New' rendering operation using vertex buffers.
virtual DepthBuffer * _createDepthBufferFor(RenderTarget *renderTarget)
Creates a DepthBuffer that can be attached to the specified RenderTarget.
void _render(const RenderOperation &op)
Render something to the active viewport.
void setClipPlanesImpl(const PlaneList &clipPlanes)
Internal method used to set the underlying clip planes when needed.
void _setTextureMipmapBias(size_t unit, float bias)
Sets the mipmap bias value for a given texture unit.
void _setSeparateSceneBlending(SceneBlendFactor sourceFactor, SceneBlendFactor destFactor, SceneBlendFactor sourceFactorAlpha, SceneBlendFactor destFactorAlpha, SceneBlendOperation op=SBO_ADD, SceneBlendOperation alphaOp=SBO_ADD)
Sets the global blending factors for combining subsequent renders with the existing frame contents...
void _setTextureLayerAnisotropy(size_t unit, unsigned int maxAnisotropy)
Sets the maximal anisotropy for the specified texture unit.
FilterOptions FilterMinification[OGRE_MAX_TEXTURE_LAYERS]
ShadeOptions
Light shading modes.
bool mUseNVPerfHUD
NVPerfHUD allowed?
void enableClipPlane(ushort index, bool enable)
FilterOptions FilterMips[OGRE_MAX_TEXTURE_LAYERS]
PolygonMode
The polygon mode to use when rasterising.
void setStencilCheckEnabled(bool enabled)
Turns stencil buffer checking on or off.
SceneBlendOperation
Blending operations controls how objects are blended into the scene.
void registerThread()
Register the an additional thread which may make calls to rendersystem-related objects.
void preExtraThreadsStarted()
Tell the rendersystem to perform any prep tasks it needs to directly before other threads which might...
A frustum represents a pyramid, capped at the near and far end which is used to represent either a vi...
This class represents a render target that renders to multiple RenderTextures at once.
std::map< String, ID3D11ClassInstance * > ClassInstanceMap
OGRE_D3D11_DRIVER_TYPE mDriverType
vector< D3D11RenderWindowBase * >::type SecondaryWindowList
Factory class for D3D11 HLSL programs.
bool mPerStageConstantSupport
Per-stage constant support? (not in main caps since D3D specific & minor)
void _endFrame(void)
Ends rendering of a frame to the current viewport.
void _setTextureCoordSet(size_t unit, size_t index)
Sets the texture coordinate set to use for a texture unit.
virtual String getErrorDescription(long errorNumber) const
Returns a description of an error code.
void processInputDevices(void)
ID3D11ShaderResourceView * pTex
texture
D3D11_SAMPLER_DESC currentSamplerDesc
void setVertexBufferBinding(VertexBufferBinding *binding)
Sets the current vertex buffer binding state.
D3D11HLSLProgram * _getBoundFragmentProgram() const
structure holding texture unit settings for every stage
ID3D11RasterizerState * mBoundRasterizer
virtual void beginProfileEvent(const String &eventName)
This marks the beginning of an event for GPU profiling.
void detachRenderTargetImpl(const String &name)
Wrapper class which indicates a given angle value is in Radians.
void _setCullingMode(CullingMode mode)
Sets the culling mode for the render system based on the 'vertex winding'.