2
0

CmD3D11RenderSystem.cpp 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. #include "CmD3D11RenderSystem.h"
  2. #include "CmRenderSystem.h"
  3. #include "CmException.h"
  4. namespace CamelotEngine
  5. {
  6. D3D11Device& D3D11RenderSystem::getPrimaryDevice()
  7. {
  8. CM_EXCEPT(NotImplementedException, "Not implemented");
  9. }
  10. void D3D11RenderSystem::determineFSAASettings(UINT32 fsaa, const String& fsaaHint, DXGI_FORMAT format, DXGI_SAMPLE_DESC* outFSAASettings)
  11. {
  12. CM_EXCEPT(NotImplementedException, "Not implemented");
  13. /*
  14. bool ok = false;
  15. bool qualityHint = fsaaHint.find("Quality") != String::npos;
  16. size_t origFSAA = fsaa;
  17. bool tryCSAA = false;
  18. // NVIDIA, prefer CSAA if available for 8+
  19. // it would be tempting to use getCapabilities()->getVendor() == GPU_NVIDIA but
  20. // if this is the first window, caps will not be initialised yet
  21. if (mActiveD3DDriver->getAdapterIdentifier().VendorId == 0x10DE &&
  22. fsaa >= 8)
  23. {
  24. tryCSAA = true;
  25. }
  26. while (!ok)
  27. {
  28. // Deal with special cases
  29. if (tryCSAA)
  30. {
  31. // see http://developer.nvidia.com/object/coverage-sampled-aa.html
  32. switch(fsaa)
  33. {
  34. case 8:
  35. if (qualityHint)
  36. {
  37. outFSAASettings->Count = 8;
  38. outFSAASettings->Quality = 8;
  39. }
  40. else
  41. {
  42. outFSAASettings->Count = 4;
  43. outFSAASettings->Quality = 8;
  44. }
  45. break;
  46. case 16:
  47. if (qualityHint)
  48. {
  49. outFSAASettings->Count = 8;
  50. outFSAASettings->Quality = 16;
  51. }
  52. else
  53. {
  54. outFSAASettings->Count = 4;
  55. outFSAASettings->Quality = 16;
  56. }
  57. break;
  58. }
  59. }
  60. else // !CSAA
  61. {
  62. outFSAASettings->Count = fsaa == 0 ? 1 : fsaa;
  63. outFSAASettings->Quality = 0;
  64. }
  65. HRESULT hr;
  66. UINT outQuality;
  67. hr = mDevice->CheckMultisampleQualityLevels(
  68. format,
  69. outFSAASettings->Count,
  70. &outQuality);
  71. if (SUCCEEDED(hr) && (!tryCSAA || outQuality > outFSAASettings->Quality))
  72. {
  73. ok = true;
  74. }
  75. else
  76. {
  77. // downgrade
  78. if (tryCSAA && fsaa == 8)
  79. {
  80. // for CSAA, we'll try downgrading with quality mode at all samples.
  81. // then try without quality, then drop CSAA
  82. if (qualityHint)
  83. {
  84. // drop quality first
  85. qualityHint = false;
  86. }
  87. else
  88. {
  89. // drop CSAA entirely
  90. tryCSAA = false;
  91. }
  92. // return to original requested samples
  93. fsaa = static_cast<UINT32>(origFSAA);
  94. }
  95. else
  96. {
  97. // drop samples
  98. --fsaa;
  99. if (fsaa == 1)
  100. {
  101. // ran out of options, no FSAA
  102. fsaa = 0;
  103. ok = true;
  104. }
  105. }
  106. }
  107. } // while !ok
  108. */
  109. }
  110. bool D3D11RenderSystem::checkTextureFilteringSupported(TextureType ttype, PixelFormat format, int usage)
  111. {
  112. return true;
  113. }
  114. const String& D3D11RenderSystem::getName() const
  115. {
  116. throw std::exception("The method or operation is not implemented.");
  117. }
  118. void D3D11RenderSystem::setSamplerState(UINT16 texUnit, const SamplerState& samplerState)
  119. {
  120. throw std::exception("The method or operation is not implemented.");
  121. }
  122. void D3D11RenderSystem::setBlendState(const BlendState& blendState)
  123. {
  124. throw std::exception("The method or operation is not implemented.");
  125. }
  126. void D3D11RenderSystem::setRasterizerState(const RasterizerState& rasterizerState)
  127. {
  128. throw std::exception("The method or operation is not implemented.");
  129. }
  130. void D3D11RenderSystem::setDepthStencilState(const DepthStencilState& depthStencilState)
  131. {
  132. throw std::exception("The method or operation is not implemented.");
  133. }
  134. void D3D11RenderSystem::setStencilRefValue(UINT32 refValue)
  135. {
  136. throw std::exception("The method or operation is not implemented.");
  137. }
  138. void D3D11RenderSystem::setTexture(UINT16 unit, bool enabled, const TexturePtr &texPtr)
  139. {
  140. throw std::exception("The method or operation is not implemented.");
  141. }
  142. void D3D11RenderSystem::beginFrame()
  143. {
  144. throw std::exception("The method or operation is not implemented.");
  145. }
  146. void D3D11RenderSystem::endFrame()
  147. {
  148. throw std::exception("The method or operation is not implemented.");
  149. }
  150. void D3D11RenderSystem::setViewport(const Viewport& vp)
  151. {
  152. throw std::exception("The method or operation is not implemented.");
  153. }
  154. void D3D11RenderSystem::setVertexDeclaration(VertexDeclarationPtr decl)
  155. {
  156. throw std::exception("The method or operation is not implemented.");
  157. }
  158. void D3D11RenderSystem::setVertexBufferBinding(VertexBufferBinding* binding)
  159. {
  160. throw std::exception("The method or operation is not implemented.");
  161. }
  162. void D3D11RenderSystem::bindGpuProgramParameters(GpuProgramType gptype, GpuProgramParametersSharedPtr params, UINT16 variabilityMask)
  163. {
  164. throw std::exception("The method or operation is not implemented.");
  165. }
  166. void D3D11RenderSystem::setScissorRect(UINT32 left /*= 0*/, UINT32 top /*= 0*/, UINT32 right /*= 800*/, UINT32 bottom /*= 600 */)
  167. {
  168. throw std::exception("The method or operation is not implemented.");
  169. }
  170. void D3D11RenderSystem::clearFrameBuffer(unsigned int buffers, const Color& color /*= Color::Black*/, float depth /*= 1.0f*/, unsigned short stencil /*= 0 */)
  171. {
  172. throw std::exception("The method or operation is not implemented.");
  173. }
  174. void D3D11RenderSystem::setRenderTarget(RenderTarget* target)
  175. {
  176. throw std::exception("The method or operation is not implemented.");
  177. }
  178. CamelotEngine::VertexElementType D3D11RenderSystem::getColorVertexElementType() const
  179. {
  180. throw std::exception("The method or operation is not implemented.");
  181. }
  182. void D3D11RenderSystem::convertProjectionMatrix(const Matrix4& matrix, Matrix4& dest, bool forGpuProgram /*= false */)
  183. {
  184. throw std::exception("The method or operation is not implemented.");
  185. }
  186. float D3D11RenderSystem::getHorizontalTexelOffset()
  187. {
  188. throw std::exception("The method or operation is not implemented.");
  189. }
  190. float D3D11RenderSystem::getVerticalTexelOffset()
  191. {
  192. throw std::exception("The method or operation is not implemented.");
  193. }
  194. float D3D11RenderSystem::getMinimumDepthInputValue()
  195. {
  196. throw std::exception("The method or operation is not implemented.");
  197. }
  198. float D3D11RenderSystem::getMaximumDepthInputValue()
  199. {
  200. throw std::exception("The method or operation is not implemented.");
  201. }
  202. void D3D11RenderSystem::setClipPlanesImpl(const PlaneList& clipPlanes)
  203. {
  204. throw std::exception("The method or operation is not implemented.");
  205. }
  206. RenderSystemCapabilities* D3D11RenderSystem::createRenderSystemCapabilities() const
  207. {
  208. throw std::exception("The method or operation is not implemented.");
  209. }
  210. void D3D11RenderSystem::initialiseFromRenderSystemCapabilities(RenderSystemCapabilities* caps)
  211. {
  212. throw std::exception("The method or operation is not implemented.");
  213. }
  214. CamelotEngine::String D3D11RenderSystem::getErrorDescription(long errorNumber) const
  215. {
  216. throw std::exception("The method or operation is not implemented.");
  217. }
  218. }