CmD3D11HLSLProgramFactory.cpp 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #include "CmD3D11HLSLProgramFactory.h"
  2. #include "CmD3D11GpuProgram.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 cm_core_ptr<D3D11GpuVertexProgram, PoolAlloc>(new (cm_alloc<D3D11GpuVertexProgram, PoolAlloc>())
  23. D3D11GpuVertexProgram(source, entryPoint, profile, includes, requireAdjacencyInfo));
  24. case GPT_FRAGMENT_PROGRAM:
  25. return cm_core_ptr<D3D11GpuFragmentProgram, PoolAlloc>(new (cm_alloc<D3D11GpuFragmentProgram, PoolAlloc>())
  26. D3D11GpuFragmentProgram(source, entryPoint, profile, includes, requireAdjacencyInfo));
  27. case GPT_HULL_PROGRAM:
  28. return cm_core_ptr<D3D11GpuHullProgram, PoolAlloc>(new (cm_alloc<D3D11GpuHullProgram, PoolAlloc>())
  29. D3D11GpuHullProgram(source, entryPoint, profile, includes, requireAdjacencyInfo));
  30. case GPT_DOMAIN_PROGRAM:
  31. return cm_core_ptr<D3D11GpuDomainProgram, PoolAlloc>(new (cm_alloc<D3D11GpuDomainProgram, PoolAlloc>())
  32. D3D11GpuDomainProgram(source, entryPoint, profile, includes, requireAdjacencyInfo));
  33. case GPT_GEOMETRY_PROGRAM:
  34. return cm_core_ptr<D3D11GpuGeometryProgram, PoolAlloc>(new (cm_alloc<D3D11GpuGeometryProgram, PoolAlloc>())
  35. D3D11GpuGeometryProgram(source, entryPoint, profile, includes, requireAdjacencyInfo));
  36. }
  37. return nullptr;
  38. }
  39. GpuProgramPtr D3D11HLSLProgramFactory::create()
  40. {
  41. return cm_core_ptr<D3D11GpuVertexProgram, PoolAlloc>(new (cm_alloc<D3D11GpuVertexProgram, PoolAlloc>())
  42. D3D11GpuVertexProgram("", "", GPP_NONE, nullptr, false));
  43. }
  44. }