texturev: Added renderer .ini setting.
This commit is contained in:
parent
f27f44f974
commit
7ae40fb95d
@ -247,10 +247,26 @@ extern "C" uint32_t __stdcall GetModuleFileNameA(void* _module, char* _outFilePa
|
|||||||
|
|
||||||
#endif // BX_PLATFORM_WINDOWS
|
#endif // BX_PLATFORM_WINDOWS
|
||||||
|
|
||||||
|
struct RendererTypeRemap
|
||||||
|
{
|
||||||
|
bx::StringView name;
|
||||||
|
bgfx::RendererType::Enum type;
|
||||||
|
};
|
||||||
|
|
||||||
|
static RendererTypeRemap s_rendererTypeRemap[] =
|
||||||
|
{
|
||||||
|
{ "gl", bgfx::RendererType::OpenGL },
|
||||||
|
{ "d3d11", bgfx::RendererType::Direct3D11 },
|
||||||
|
{ "d3d11", bgfx::RendererType::Direct3D12 },
|
||||||
|
{ "vk", bgfx::RendererType::Vulkan },
|
||||||
|
{ "mtl", bgfx::RendererType::Metal },
|
||||||
|
};
|
||||||
|
|
||||||
struct View
|
struct View
|
||||||
{
|
{
|
||||||
View()
|
View()
|
||||||
: m_cubeMapGeo(Geometry::Quad)
|
: m_rendererType(bgfx::RendererType::Count)
|
||||||
|
, m_cubeMapGeo(Geometry::Quad)
|
||||||
, m_outputFormat(Output::sRGB)
|
, m_outputFormat(Output::sRGB)
|
||||||
, m_fileIndex(0)
|
, m_fileIndex(0)
|
||||||
, m_scaleFn(0)
|
, m_scaleFn(0)
|
||||||
@ -801,6 +817,23 @@ struct View
|
|||||||
{
|
{
|
||||||
m_height = 720;
|
m_height = 720;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bx::StringView rendererType = settings.get("view/renderer");
|
||||||
|
if (!rendererType.isEmpty() )
|
||||||
|
{
|
||||||
|
m_rendererType = bgfx::RendererType::Count;
|
||||||
|
|
||||||
|
for (uint32_t ii = 0; ii < BX_COUNTOF(s_rendererTypeRemap); ++ii)
|
||||||
|
{
|
||||||
|
const RendererTypeRemap& remap = s_rendererTypeRemap[ii];
|
||||||
|
|
||||||
|
if (0 == bx::strCmpI(rendererType, remap.name) )
|
||||||
|
{
|
||||||
|
m_rendererType = remap.type;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -823,6 +856,20 @@ struct View
|
|||||||
bx::toString(tmp, sizeof(tmp), m_height);
|
bx::toString(tmp, sizeof(tmp), m_height);
|
||||||
settings.set("view/height", tmp);
|
settings.set("view/height", tmp);
|
||||||
|
|
||||||
|
if (m_rendererType != bgfx::RendererType::Count)
|
||||||
|
{
|
||||||
|
for (uint32_t ii = 0; ii < BX_COUNTOF(s_rendererTypeRemap); ++ii)
|
||||||
|
{
|
||||||
|
const RendererTypeRemap& remap = s_rendererTypeRemap[ii];
|
||||||
|
|
||||||
|
if (m_rendererType == remap.type)
|
||||||
|
{
|
||||||
|
settings.set("view/renderer", remap.name);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bx::FileWriter writer;
|
bx::FileWriter writer;
|
||||||
if (bx::open(&writer, filePath) )
|
if (bx::open(&writer, filePath) )
|
||||||
{
|
{
|
||||||
@ -837,6 +884,7 @@ struct View
|
|||||||
typedef stl::vector<std::string> FileList;
|
typedef stl::vector<std::string> FileList;
|
||||||
FileList m_fileList;
|
FileList m_fileList;
|
||||||
|
|
||||||
|
bgfx::RendererType::Enum m_rendererType;
|
||||||
bgfx::TextureInfo m_textureInfo;
|
bgfx::TextureInfo m_textureInfo;
|
||||||
Geometry::Enum m_cubeMapGeo;
|
Geometry::Enum m_cubeMapGeo;
|
||||||
Output::Enum m_outputFormat;
|
Output::Enum m_outputFormat;
|
||||||
@ -1291,6 +1339,7 @@ int _main_(int _argc, char** _argv)
|
|||||||
entry::setWindowSize(entry::WindowHandle{0}, view.m_width, view.m_height);
|
entry::setWindowSize(entry::WindowHandle{0}, view.m_width, view.m_height);
|
||||||
|
|
||||||
bgfx::Init init;
|
bgfx::Init init;
|
||||||
|
init.type = view.m_rendererType;
|
||||||
init.resolution.width = view.m_width;
|
init.resolution.width = view.m_width;
|
||||||
init.resolution.height = view.m_height;
|
init.resolution.height = view.m_height;
|
||||||
init.resolution.reset = BGFX_RESET_VSYNC;
|
init.resolution.reset = BGFX_RESET_VSYNC;
|
||||||
|
Loading…
Reference in New Issue
Block a user