parent
4ffaac6d6f
commit
3b42b7b694
|
@ -10,6 +10,7 @@
|
|||
#include "xenia/gpu/gl4/gl_context.h"
|
||||
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
|
||||
#include "xenia/base/assert.h"
|
||||
#include "xenia/base/logging.h"
|
||||
|
@ -196,6 +197,42 @@ std::unique_ptr<GLContext> GLContext::CreateShared() {
|
|||
return new_context;
|
||||
}
|
||||
|
||||
void FatalGLError(std::string error) {
|
||||
XEFATAL(
|
||||
(error +
|
||||
"\nEnsure you have the latest drivers for your GPU and that it supports "
|
||||
"OpenGL 4.5. See http://xenia.jp/faq/ for more information.").c_str());
|
||||
}
|
||||
|
||||
void GLContext::AssertExtensionsPresent() {
|
||||
if (!MakeCurrent()) {
|
||||
XEFATAL("Unable to make GL context current");
|
||||
return;
|
||||
}
|
||||
|
||||
// Check shader version at least 4.5 (matching GL 4.5).
|
||||
auto glsl_version_start =
|
||||
reinterpret_cast<const char*>(glGetString(GL_SHADING_LANGUAGE_VERSION));
|
||||
auto glsl_version_end = std::strchr(glsl_version_start, ' ');
|
||||
std::string glsl_version(glsl_version_start, glsl_version_end);
|
||||
if (glsl_version.compare("4.50") != 0) {
|
||||
FatalGLError("OpenGL GLSL version 4.50 is required.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!GLEW_ARB_bindless_texture) {
|
||||
FatalGLError("OpenGL extension ARB_bindless_texture is required.");
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO(benvanik): figure out why this query fails.
|
||||
// if (!GLEW_ARB_fragment_coord_conventions) {
|
||||
// FatalGLError(
|
||||
// "OpenGL extension ARB_fragment_coord_conventions is required.");
|
||||
// return;
|
||||
// }
|
||||
}
|
||||
|
||||
void GLContext::DebugMessage(GLenum source, GLenum type, GLuint id,
|
||||
GLenum severity, GLsizei length,
|
||||
const GLchar* message) {
|
||||
|
|
|
@ -28,6 +28,7 @@ class GLContext {
|
|||
~GLContext();
|
||||
|
||||
bool Initialize(HWND hwnd);
|
||||
void AssertExtensionsPresent();
|
||||
|
||||
HDC dc() const { return dc_; }
|
||||
|
||||
|
|
|
@ -63,10 +63,12 @@ bool WGLControl::Create() {
|
|||
XEFATAL(
|
||||
"Unable to initialize GL context. Xenia requires OpenGL 4.5. Ensure "
|
||||
"you have the latest drivers for your GPU and that it supports OpenGL "
|
||||
"4.5.");
|
||||
"4.5. See http://xenia.jp/faq/ for more information.");
|
||||
return false;
|
||||
}
|
||||
|
||||
context_.AssertExtensionsPresent();
|
||||
|
||||
SetFocus(hwnd_);
|
||||
|
||||
OnCreate();
|
||||
|
|
Loading…
Reference in New Issue