fractorium/Source/EmberCL/RendererClDevice.cpp
mfeemster 7c856c929c --Bug fixes
-Really fix locking of affine scale.

--Code changes
 -Remove dependency projects from the solution. Move to a project design where they are built once via command line and stored in a /Deps folder.
  --Because of this, libpng is built as a static lib instead of a dll because that's what its command line makefile supports.
  --Remove libpng16.dll from Wix installer.
 -Remove all configs except for debug and release.
 -Remove all platforms except for x64.
 -Add #define __TBB_NO_IMPLICIT_LINKAGE 1 to prevent tbb from locking for tbb_debug.lib by default on debug builds.
 -Put Ember.rc in a filter folder in the project.
 -Place pragma warning disable statements in PCH files rather than in projects. This makes it easier when using Qt Creator.
 -Move all resource files to the MSVC folder.
 -Set all targets in QtCreator project to their lowercase names to be more *nix friendly. Set -l link statements to use these new lowercase names for ember and embercl.
 -Rework projects to favor shadow builds.
 -Remove the symlinks.sh file and all references to it. It was never needed. Instead, just specify multiple include and link paths in the .pro files.
 -Change WIN32 to _WIN32.
 -Fix a few code warnings.
2016-03-01 17:26:45 -08:00

59 lines
1.6 KiB
C++

#include "EmberCLPch.h"
#include "RendererClDevice.h"
namespace EmberCLns
{
/// <summary>
/// Constructor that assigns members.
/// The object is not fully initialized at this point, the caller
/// must manually call Init().
/// </summary>
/// <param name="platform">The index of the platform to use</param>
/// <param name="device">The index device of the device to use</param>
/// <param name="shared">True if shared with OpenGL, else false.</param>
/// <returns>True if success, else false.</returns>
RendererClDevice::RendererClDevice(size_t platform, size_t device, bool shared)
{
m_Init = false;
m_Shared = shared;
m_NVidia = false;
m_WarpSize = 0;
m_Calls = 0;
m_PlatformIndex = platform;
m_DeviceIndex = device;
m_Info = OpenCLInfo::Instance();
}
/// <summary>
/// Initialization of the OpenCLWrapper member.
/// </summary>
/// <returns>True if success, else false.</returns>
bool RendererClDevice::Init()
{
bool b = true;
if (!m_Wrapper.Ok())
{
m_Init = false;
b = m_Wrapper.Init(m_PlatformIndex, m_DeviceIndex, m_Shared);
}
if (b && m_Wrapper.Ok() && !m_Init)
{
m_NVidia = ToLower(m_Info->PlatformName(m_PlatformIndex)).find_first_of("nvidia") != string::npos && m_Wrapper.LocalMemSize() > (32 * 1024);
m_WarpSize = m_NVidia ? 32 : 64;
m_Init = true;
}
return b;
}
/// <summary>
/// OpenCL property accessors, getters only.
/// </summary>
bool RendererClDevice::Ok() const { return m_Init; }
bool RendererClDevice::Shared() const { return m_Shared; }
bool RendererClDevice::Nvidia() const { return m_NVidia; }
size_t RendererClDevice::WarpSize() const { return m_WarpSize; }
}