GL: Added clip control support.

This commit is contained in:
Branimir Karadžić
2016-04-01 12:40:18 -07:00
parent cfa8224404
commit c4fa56092b
5 changed files with 35 additions and 0 deletions

View File

@@ -499,6 +499,8 @@ namespace bgfx
uint8_t numGPUs; //!< Number of enumerated GPUs.
uint16_t vendorId; //!< Selected GPU vendor id.
uint16_t deviceId; //!< Selected GPU device id.
bool homogeneousDepth; //!< True when NDC depth is in [-1, 1] range.
bool originBottomLeft; //!< True when NDC origin is at bottom left.
/// GPU info.
///

View File

@@ -393,6 +393,8 @@ typedef struct bgfx_caps
uint16_t maxViews;
uint8_t maxFBAttachments;
uint8_t numGPUs;
bool homogeneousDepth;
bool originBottomLeft;
uint16_t vendorId;
uint16_t deviceId;

View File

@@ -1151,6 +1151,10 @@ namespace bgfx
}
BX_TRACE("Max FB attachments: %d", g_caps.maxFBAttachments);
BX_TRACE("NDC depth [%d, 1], origin %s left."
, g_caps.homogeneousDepth ? -1 : 0
, g_caps.originBottomLeft ? "bottom" : "top"
);
}
TextureFormat::Enum getViableTextureFormat(const ImageContainer& _imageContainer)

View File

@@ -1818,6 +1818,17 @@ namespace bgfx { namespace gl
);
}
if (s_extension[Extension::ARB_clip_control].m_supported)
{
GL_CHECK(glClipControl(GL_LOWER_LEFT, GL_ZERO_TO_ONE) );
g_caps.originBottomLeft = true;
}
else
{
g_caps.homogeneousDepth = true;
g_caps.originBottomLeft = true;
}
m_vaoSupport = !!(BGFX_CONFIG_RENDERER_OPENGLES >= 30)
|| s_extension[Extension::ARB_vertex_array_object].m_supported
|| s_extension[Extension::OES_vertex_array_object].m_supported

View File

@@ -791,6 +791,22 @@ typedef uint64_t GLuint64;
# define GL_CONSERVATIVE_RASTERIZATION_NV 0x9346
#endif // GL_CONSERVATIVE_RASTERIZATION_NV
#ifndef GL_NEGATIVE_ONE_TO_ONE
# define GL_NEGATIVE_ONE_TO_ONE 0x935E
#endif // GL_NEGATIVE_ONE_TO_ONE
#ifndef GL_ZERO_TO_ONE
# define GL_ZERO_TO_ONE 0x935F
#endif // GL_ZERO_TO_ONE
#ifndef GL_LOWER_LEFT
# define GL_LOWER_LEFT 0x8CA1
#endif // GL_LOWER_LEFT
#ifndef GL_UPPER_LEFT
# define GL_UPPER_LEFT 0x8CA2
#endif // GL_UPPER_LEFT
// _KHR or _ARB...
#define GL_DEBUG_OUTPUT_SYNCHRONOUS 0x8242
#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH 0x8243