BsD3D11HLSLProgramFactory.cpp 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. //__________________________ Banshee Project - A modern game development toolkit _________________________________//
  2. //_____________________________________ www.banshee-project.com __________________________________________________//
  3. //________________________ Copyright (c) 2014 Marko Pintera. All rights reserved. ________________________________//
  4. #include "BsD3D11HLSLProgramFactory.h"
  5. #include "BsD3D11GpuProgram.h"
  6. namespace BansheeEngine
  7. {
  8. const String D3D11HLSLProgramFactory::LANGUAGE_NAME = "hlsl";
  9. D3D11HLSLProgramFactory::D3D11HLSLProgramFactory()
  10. {
  11. }
  12. D3D11HLSLProgramFactory::~D3D11HLSLProgramFactory()
  13. {
  14. }
  15. const String& D3D11HLSLProgramFactory::getLanguage(void) const
  16. {
  17. return LANGUAGE_NAME;
  18. }
  19. GpuProgramPtr D3D11HLSLProgramFactory::create(const String& source, const String& entryPoint,
  20. GpuProgramType gptype, GpuProgramProfile profile, const Vector<HGpuProgInclude>* includes, bool requireAdjacencyInfo)
  21. {
  22. switch (gptype)
  23. {
  24. case GPT_VERTEX_PROGRAM:
  25. return bs_core_ptr<D3D11GpuVertexProgram, PoolAlloc>(new (bs_alloc<D3D11GpuVertexProgram, PoolAlloc>())
  26. D3D11GpuVertexProgram(source, entryPoint, profile, includes));
  27. case GPT_FRAGMENT_PROGRAM:
  28. return bs_core_ptr<D3D11GpuFragmentProgram, PoolAlloc>(new (bs_alloc<D3D11GpuFragmentProgram, PoolAlloc>())
  29. D3D11GpuFragmentProgram(source, entryPoint, profile, includes));
  30. case GPT_HULL_PROGRAM:
  31. return bs_core_ptr<D3D11GpuHullProgram, PoolAlloc>(new (bs_alloc<D3D11GpuHullProgram, PoolAlloc>())
  32. D3D11GpuHullProgram(source, entryPoint, profile, includes));
  33. case GPT_DOMAIN_PROGRAM:
  34. return bs_core_ptr<D3D11GpuDomainProgram, PoolAlloc>(new (bs_alloc<D3D11GpuDomainProgram, PoolAlloc>())
  35. D3D11GpuDomainProgram(source, entryPoint, profile, includes));
  36. case GPT_GEOMETRY_PROGRAM:
  37. return bs_core_ptr<D3D11GpuGeometryProgram, PoolAlloc>(new (bs_alloc<D3D11GpuGeometryProgram, PoolAlloc>())
  38. D3D11GpuGeometryProgram(source, entryPoint, profile, includes, requireAdjacencyInfo));
  39. }
  40. return nullptr;
  41. }
  42. GpuProgramPtr D3D11HLSLProgramFactory::create(GpuProgramType type)
  43. {
  44. switch (type)
  45. {
  46. case GPT_VERTEX_PROGRAM:
  47. return bs_core_ptr<D3D11GpuVertexProgram, PoolAlloc>(new (bs_alloc<D3D11GpuVertexProgram, PoolAlloc>())
  48. D3D11GpuVertexProgram("", "", GPP_NONE, nullptr));
  49. case GPT_FRAGMENT_PROGRAM:
  50. return bs_core_ptr<D3D11GpuFragmentProgram, PoolAlloc>(new (bs_alloc<D3D11GpuFragmentProgram, PoolAlloc>())
  51. D3D11GpuFragmentProgram("", "", GPP_NONE, nullptr));
  52. case GPT_HULL_PROGRAM:
  53. return bs_core_ptr<D3D11GpuHullProgram, PoolAlloc>(new (bs_alloc<D3D11GpuHullProgram, PoolAlloc>())
  54. D3D11GpuHullProgram("", "", GPP_NONE, nullptr));
  55. case GPT_DOMAIN_PROGRAM:
  56. return bs_core_ptr<D3D11GpuDomainProgram, PoolAlloc>(new (bs_alloc<D3D11GpuDomainProgram, PoolAlloc>())
  57. D3D11GpuDomainProgram("", "", GPP_NONE, nullptr));
  58. case GPT_GEOMETRY_PROGRAM:
  59. return bs_core_ptr<D3D11GpuGeometryProgram, PoolAlloc>(new (bs_alloc<D3D11GpuGeometryProgram, PoolAlloc>())
  60. D3D11GpuGeometryProgram("", "", GPP_NONE, nullptr, false));
  61. }
  62. return nullptr;
  63. }
  64. }