IDisplayInfo.h#

Fully qualified name: omni/platforminfo/IDisplayInfo.h

File members: omni/platforminfo/IDisplayInfo.h

// Copyright (c) 2021-2024, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
#pragma once

#include "../../carb/Types.h"
#include "../core/IObject.h"

namespace omni
{
namespace platforminfo
{

class IDisplayInfo;

using DisplayFlags OMNI_ATTR("flag, prefix=fDisplayFlag") = uint32_t;

constexpr DisplayFlags fDisplayFlagPrimary = 0x01;

using ModeFlags OMNI_ATTR("flag, prefix=fModeFlag") = uint32_t;

constexpr ModeFlags fModeFlagInterlaced = 0x01;

constexpr ModeFlags fModeFlagStretched = 0x02;

constexpr ModeFlags fModeFlagCentered = 0x04;

using ModeIndex OMNI_ATTR("constant, prefix=kModeIndex") = size_t;

constexpr ModeIndex kModeIndexCurrent = (ModeIndex)~0ull;

enum class OMNI_ATTR("prefix=e") Orientation
{
    eDefault,
    e90,
    e180,
    e270,
};

struct ModeInfo
{
    carb::Int2 size = {};
    uint32_t bitsPerPixel = 0;
    uint32_t refreshRate = 0;
    ModeFlags flags = 0;
    Orientation orientation = Orientation::eDefault;
};

struct DisplayInfo
{
    char OMNI_ATTR("c_str") displayName[128] = {};

    char OMNI_ATTR("c_str") displayId[128] = {};

    char OMNI_ATTR("c_str") adapterName[128] = {};

    char OMNI_ATTR("c_str") adapterId[128] = {};

    carb::Int2 origin = {};

    ModeInfo current = {};

    DisplayFlags flags = 0;
};

class IDisplayInfo_abi : public omni::core::Inherits<omni::core::IObject, OMNI_TYPE_ID("omni.platforminfo.IDisplayInfo")>
{
protected:
    virtual size_t getDisplayCount_abi() noexcept = 0;

    virtual bool getDisplayInfo_abi(size_t displayIndex, OMNI_ATTR("out, not_null") DisplayInfo* infoOut) noexcept = 0;

    virtual size_t getModeCount_abi(OMNI_ATTR("in, not_null") const DisplayInfo* display) noexcept = 0;

    virtual bool getModeInfo_abi(OMNI_ATTR("in, not_null") const DisplayInfo* display,
                                 ModeIndex modeIndex,
                                 OMNI_ATTR("out, not_null") ModeInfo* infoOut) noexcept = 0;

    virtual bool getTotalDisplaySize_abi(OMNI_ATTR("out") carb::Int2* origin,
                                         OMNI_ATTR("out") carb::Int2* size) noexcept = 0;
};

} // namespace platforminfo
} // namespace omni

#define OMNI_BIND_INCLUDE_INTERFACE_DECL
#include "IDisplayInfo.gen.h"

class omni::platforminfo::IDisplayInfo : public omni::core::Generated<omni::platforminfo::IDisplayInfo_abi>
{
};

#define OMNI_BIND_INCLUDE_INTERFACE_IMPL
#include "IDisplayInfo.gen.h"