summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineOpenGL
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-02-17 04:03:37 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-02-17 04:03:37 +0000
commit7c1ca4e7330fc9c3cf260af64ca8245145b057db (patch)
tree780bd6aec8a4243374fb36482cf3be9fc4526426 /Graphics/GraphicsEngineOpenGL
parentFixed few HLSL->GLSL conversion issues on MacOS (diff)
downloadDiligentCore-7c1ca4e7330fc9c3cf260af64ca8245145b057db.tar.gz
DiligentCore-7c1ca4e7330fc9c3cf260af64ca8245145b057db.zip
Added platform macros in GLSL shaders
Diffstat (limited to 'Graphics/GraphicsEngineOpenGL')
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/GLContextMacOS.mm6
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/ShaderGLImpl.cpp14
2 files changed, 16 insertions, 4 deletions
diff --git a/Graphics/GraphicsEngineOpenGL/src/GLContextMacOS.mm b/Graphics/GraphicsEngineOpenGL/src/GLContextMacOS.mm
index 65942afb..378d2d76 100644
--- a/Graphics/GraphicsEngineOpenGL/src/GLContextMacOS.mm
+++ b/Graphics/GraphicsEngineOpenGL/src/GLContextMacOS.mm
@@ -32,17 +32,17 @@
static void glDrawArraysInstancedBaseInstance_stub(GLenum mode, GLint first, GLsizei count, GLsizei primcount, GLuint baseinstance)
{
- LOG_ERROR_MESSAGE_ONCE("glDrawArraysInstancedBaseInstance is not supported on MacOS");
+ LOG_ERROR_MESSAGE("glDrawArraysInstancedBaseInstance is not supported on MacOS");
}
static void glDrawElementsInstancedBaseInstance_stub(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount, GLuint baseinstance)
{
- LOG_ERROR_MESSAGE_ONCE("glDrawElementsInstancedBaseInstance is not supported on MacOS");
+ LOG_ERROR_MESSAGE("glDrawElementsInstancedBaseInstance is not supported on MacOS");
}
static void glDrawElementsInstancedBaseVertexBaseInstance_stub(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount, GLint basevertex, GLuint baseinstance)
{
- LOG_ERROR_MESSAGE_ONCE("glDrawElementsInstancedBaseVertexBaseInstance is not supported on MacOS");
+ LOG_ERROR_MESSAGE("glDrawElementsInstancedBaseVertexBaseInstance is not supported on MacOS");
}
diff --git a/Graphics/GraphicsEngineOpenGL/src/ShaderGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/ShaderGLImpl.cpp
index cc980b83..bd659d15 100644
--- a/Graphics/GraphicsEngineOpenGL/src/ShaderGLImpl.cpp
+++ b/Graphics/GraphicsEngineOpenGL/src/ShaderGLImpl.cpp
@@ -52,10 +52,18 @@ ShaderGLImpl::ShaderGLImpl(IReferenceCounters *pRefCounters, RenderDeviceGLImpl
"#version 430 core\n"
"#define DESKTOP_GL 1\n"
);
+# if PLATFORM_WIN32
+ Settings.append("#define PLATFORM_WIN32 1\n");
+# elif PLATFORM_LINUX
+ Settings.append("#define PLATFORM_LINUX 1\n");
+# else
+# error Unexpected platform
+# endif
#elif PLATFORM_MACOS
Settings.append(
"#version 410 core\n"
"#define DESKTOP_GL 1\n"
+ "#define PLATFORM_MACOS 1\n"
);
#elif PLATFORM_IOS
Settings.append(
@@ -65,6 +73,8 @@ ShaderGLImpl::ShaderGLImpl(IReferenceCounters *pRefCounters, RenderDeviceGLImpl
"# define GL_ES 1\n"
"#endif\n"
+ "#define PLATFORM_IOS 1\n"
+
"precision highp float;\n"
"precision highp int;\n"
//"precision highp uint;\n"
@@ -92,7 +102,7 @@ ShaderGLImpl::ShaderGLImpl(IReferenceCounters *pRefCounters, RenderDeviceGLImpl
if(m_Desc.ShaderType == SHADER_TYPE_VERTEX)
Settings.append("out vec4 gl_Position;\n");
-#elif defined(ANDROID)
+#elif PLATFORM_ANDROID
Settings.append(
"#version 310 es\n"
);
@@ -107,6 +117,8 @@ ShaderGLImpl::ShaderGLImpl(IReferenceCounters *pRefCounters, RenderDeviceGLImpl
"#ifndef GL_ES\n"
"# define GL_ES 1\n"
"#endif\n"
+
+ "#define PLATFORM_ANDROID 1\n"
"precision highp float;\n"
"precision highp int;\n"