summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineOpenGL
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2019-08-07 06:13:11 +0000
committerEgor Yusov <egor.yusov@gmail.com>2019-08-07 06:13:11 +0000
commitbee567b21589b63aaf60d69e693b1dd5018abb06 (patch)
tree402f5d27cee14770dde6a05b92eaf705ebb3b374 /Graphics/GraphicsEngineOpenGL
parentFixed issue with logical vs storage texture size for block-compressed formats (diff)
downloadDiligentCore-bee567b21589b63aaf60d69e693b1dd5018abb06.tar.gz
DiligentCore-bee567b21589b63aaf60d69e693b1dd5018abb06.zip
OpenGL backend: creating a dummy fragment shader when none is present in the PSO to fix issues in some GL implementations
Diffstat (limited to 'Graphics/GraphicsEngineOpenGL')
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/PipelineStateGLImpl.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/Graphics/GraphicsEngineOpenGL/src/PipelineStateGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/PipelineStateGLImpl.cpp
index ea853b4b..d00d0162 100644
--- a/Graphics/GraphicsEngineOpenGL/src/PipelineStateGLImpl.cpp
+++ b/Graphics/GraphicsEngineOpenGL/src/PipelineStateGLImpl.cpp
@@ -38,6 +38,19 @@ PipelineStateGLImpl::PipelineStateGLImpl(IReferenceCounters* pRefCounters,
TPipelineStateBase(pRefCounters, pDeviceGL, PipelineDesc, bIsDeviceInternal),
m_GLProgram(false)
{
+ if (!m_Desc.IsComputePipeline && m_pPS == nullptr)
+ {
+ // Some OpenGL implementations fail if fragment shader is not present, so
+ // create a dummy one.
+ ShaderCreateInfo ShaderCI;
+ ShaderCI.SourceLanguage = SHADER_SOURCE_LANGUAGE_GLSL;
+ ShaderCI.Source = "void main(){}";
+ ShaderCI.Desc.ShaderType = SHADER_TYPE_PIXEL;
+ ShaderCI.Desc.Name = "Dummy fragment shader";
+ pDeviceGL->CreateShader(ShaderCI, &m_pPS);
+ m_Desc.GraphicsPipeline.pPS = m_pPS;
+ m_ppShaders[m_NumShaders++] = m_pPS;
+ }
auto &DeviceCaps = pDeviceGL->GetDeviceCaps();
VERIFY( DeviceCaps.DevType != DeviceType::Undefined, "Device caps are not initialized" );