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. SPtr<GpuProgramCore> D3D11HLSLProgramFactory::create(const String& source, const String& entryPoint,
  17. GpuProgramType gptype, GpuProgramProfile profile, bool requireAdjacencyInfo)
  18. {
  19. switch (gptype)
  20. {
  21. case GPT_VERTEX_PROGRAM:
  22. return bs_shared_ptr<D3D11GpuVertexProgramCore, GenAlloc>(new (bs_alloc<D3D11GpuVertexProgramCore, GenAlloc>())
  23. D3D11GpuVertexProgramCore(source, entryPoint, profile));
  24. case GPT_FRAGMENT_PROGRAM:
  25. return bs_shared_ptr<D3D11GpuFragmentProgramCore, GenAlloc>(new (bs_alloc<D3D11GpuFragmentProgramCore, GenAlloc>())
  26. D3D11GpuFragmentProgramCore(source, entryPoint, profile));
  27. case GPT_HULL_PROGRAM:
  28. return bs_shared_ptr<D3D11GpuHullProgramCore, GenAlloc>(new (bs_alloc<D3D11GpuHullProgramCore, GenAlloc>())
  29. D3D11GpuHullProgramCore(source, entryPoint, profile));
  30. case GPT_DOMAIN_PROGRAM:
  31. return bs_shared_ptr<D3D11GpuDomainProgramCore, GenAlloc>(new (bs_alloc<D3D11GpuDomainProgramCore, GenAlloc>())
  32. D3D11GpuDomainProgramCore(source, entryPoint, profile));
  33. case GPT_GEOMETRY_PROGRAM:
  34. return bs_shared_ptr<D3D11GpuGeometryProgramCore, GenAlloc>(new (bs_alloc<D3D11GpuGeometryProgramCore, GenAlloc>())
  35. D3D11GpuGeometryProgramCore(source, entryPoint, profile, requireAdjacencyInfo));
  36. }
  37. return nullptr;
  38. }
  39. SPtr<GpuProgramCore> D3D11HLSLProgramFactory::create(GpuProgramType type)
  40. {
  41. switch (type)
  42. {
  43. case GPT_VERTEX_PROGRAM:
  44. return bs_shared_ptr<D3D11GpuVertexProgramCore, GenAlloc>(new (bs_alloc<D3D11GpuVertexProgramCore, GenAlloc>())
  45. D3D11GpuVertexProgramCore("", "", GPP_NONE));
  46. case GPT_FRAGMENT_PROGRAM:
  47. return bs_shared_ptr<D3D11GpuFragmentProgramCore, GenAlloc>(new (bs_alloc<D3D11GpuFragmentProgramCore, GenAlloc>())
  48. D3D11GpuFragmentProgramCore("", "", GPP_NONE));
  49. case GPT_HULL_PROGRAM:
  50. return bs_shared_ptr<D3D11GpuHullProgramCore, GenAlloc>(new (bs_alloc<D3D11GpuHullProgramCore, GenAlloc>())
  51. D3D11GpuHullProgramCore("", "", GPP_NONE));
  52. case GPT_DOMAIN_PROGRAM:
  53. return bs_shared_ptr<D3D11GpuDomainProgramCore, GenAlloc>(new (bs_alloc<D3D11GpuDomainProgramCore, GenAlloc>())
  54. D3D11GpuDomainProgramCore("", "", GPP_NONE));
  55. case GPT_GEOMETRY_PROGRAM:
  56. return bs_shared_ptr<D3D11GpuGeometryProgramCore, GenAlloc>(new (bs_alloc<D3D11GpuGeometryProgramCore, GenAlloc>())
  57. D3D11GpuGeometryProgramCore("", "", GPP_NONE, false));
  58. }
  59. return nullptr;
  60. }
  61. }