BsD3D11HLSLProgramFactory.cpp 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #include "BsD3D11HLSLProgramFactory.h"
  2. #include "BsD3D11GpuProgram.h"
  3. namespace BansheeEngine
  4. {
  5. const String D3D11HLSLProgramFactory::LANGUAGE_NAME = "hlsl";
  6. D3D11HLSLProgramFactory::D3D11HLSLProgramFactory()
  7. {
  8. }
  9. D3D11HLSLProgramFactory::~D3D11HLSLProgramFactory()
  10. {
  11. }
  12. const String& D3D11HLSLProgramFactory::getLanguage(void) const
  13. {
  14. return LANGUAGE_NAME;
  15. }
  16. GpuProgramPtr D3D11HLSLProgramFactory::create(const String& source, const String& entryPoint,
  17. GpuProgramType gptype, GpuProgramProfile profile, const Vector<HGpuProgInclude>* includes, bool requireAdjacencyInfo)
  18. {
  19. switch (gptype)
  20. {
  21. case GPT_VERTEX_PROGRAM:
  22. return bs_core_ptr<D3D11GpuVertexProgram, PoolAlloc>(new (bs_alloc<D3D11GpuVertexProgram, PoolAlloc>())
  23. D3D11GpuVertexProgram(source, entryPoint, profile, includes));
  24. case GPT_FRAGMENT_PROGRAM:
  25. return bs_core_ptr<D3D11GpuFragmentProgram, PoolAlloc>(new (bs_alloc<D3D11GpuFragmentProgram, PoolAlloc>())
  26. D3D11GpuFragmentProgram(source, entryPoint, profile, includes));
  27. case GPT_HULL_PROGRAM:
  28. return bs_core_ptr<D3D11GpuHullProgram, PoolAlloc>(new (bs_alloc<D3D11GpuHullProgram, PoolAlloc>())
  29. D3D11GpuHullProgram(source, entryPoint, profile, includes));
  30. case GPT_DOMAIN_PROGRAM:
  31. return bs_core_ptr<D3D11GpuDomainProgram, PoolAlloc>(new (bs_alloc<D3D11GpuDomainProgram, PoolAlloc>())
  32. D3D11GpuDomainProgram(source, entryPoint, profile, includes));
  33. case GPT_GEOMETRY_PROGRAM:
  34. return bs_core_ptr<D3D11GpuGeometryProgram, PoolAlloc>(new (bs_alloc<D3D11GpuGeometryProgram, PoolAlloc>())
  35. D3D11GpuGeometryProgram(source, entryPoint, profile, includes, requireAdjacencyInfo));
  36. }
  37. return nullptr;
  38. }
  39. GpuProgramPtr D3D11HLSLProgramFactory::create(GpuProgramType type)
  40. {
  41. switch (type)
  42. {
  43. case GPT_VERTEX_PROGRAM:
  44. return bs_core_ptr<D3D11GpuVertexProgram, PoolAlloc>(new (bs_alloc<D3D11GpuVertexProgram, PoolAlloc>())
  45. D3D11GpuVertexProgram("", "", GPP_NONE, nullptr));
  46. case GPT_FRAGMENT_PROGRAM:
  47. return bs_core_ptr<D3D11GpuFragmentProgram, PoolAlloc>(new (bs_alloc<D3D11GpuFragmentProgram, PoolAlloc>())
  48. D3D11GpuFragmentProgram("", "", GPP_NONE, nullptr));
  49. case GPT_HULL_PROGRAM:
  50. return bs_core_ptr<D3D11GpuHullProgram, PoolAlloc>(new (bs_alloc<D3D11GpuHullProgram, PoolAlloc>())
  51. D3D11GpuHullProgram("", "", GPP_NONE, nullptr));
  52. case GPT_DOMAIN_PROGRAM:
  53. return bs_core_ptr<D3D11GpuDomainProgram, PoolAlloc>(new (bs_alloc<D3D11GpuDomainProgram, PoolAlloc>())
  54. D3D11GpuDomainProgram("", "", GPP_NONE, nullptr));
  55. case GPT_GEOMETRY_PROGRAM:
  56. return bs_core_ptr<D3D11GpuGeometryProgram, PoolAlloc>(new (bs_alloc<D3D11GpuGeometryProgram, PoolAlloc>())
  57. D3D11GpuGeometryProgram("", "", GPP_NONE, nullptr, false));
  58. }
  59. return nullptr;
  60. }
  61. }