Skip to content

Commit 2f08cf5

Browse files
Kill some OpenGL methods
1 parent b37ab6b commit 2f08cf5

File tree

1 file changed

+5
-62
lines changed

1 file changed

+5
-62
lines changed

src/nbl/video/COpenGL_LogicalDevice.h

Lines changed: 5 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,8 @@ class COpenGL_LogicalDevice : public IOpenGL_LogicalDevice
149149

150150
core::smart_refctd_ptr<IGPUShader> createShader(core::smart_refctd_ptr<asset::ICPUShader>&& cpushader) override final
151151
{
152-
auto source = cpushader->getContent();
153-
auto clone = core::smart_refctd_ptr_static_cast<asset::ICPUBuffer>(source->clone(1u));
154-
return core::make_smart_refctd_ptr<COpenGLShader>(core::smart_refctd_ptr<IOpenGL_LogicalDevice>(this), std::move(clone), cpushader->getStage(), cpushader->getContentType(), std::string(cpushader->getFilepathHint()));
152+
assert(false); // OpenGL backend officially killed
153+
return nullptr;
155154
}
156155

157156
core::smart_refctd_ptr<IGPURenderpass> createRenderpass(const IGPURenderpass::SCreationParams& params) override final
@@ -727,64 +726,8 @@ class COpenGL_LogicalDevice : public IOpenGL_LogicalDevice
727726
}
728727
core::smart_refctd_ptr<IGPUSpecializedShader> createSpecializedShader_impl(const IGPUShader* _unspecialized, const asset::ISpecializedShader::SInfo& _specInfo) override final
729728
{
730-
const COpenGLShader* glUnspec = IBackendObject::device_compatibility_cast<const COpenGLShader*>(_unspecialized, this);
731-
732-
const std::string& EP = _specInfo.entryPoint;
733-
const asset::IShader::E_SHADER_STAGE stage = _unspecialized->getStage();
734-
const asset::IShader::E_CONTENT_TYPE contentType = (glUnspec->containsGLSL()) ? asset::IShader::E_CONTENT_TYPE::ECT_GLSL : asset::IShader::E_CONTENT_TYPE::ECT_SPIRV;
735-
736-
core::smart_refctd_ptr<asset::ICPUBuffer> spirv;
737-
if (glUnspec->containsGLSL())
738-
{
739-
auto begin = reinterpret_cast<const char*>(glUnspec->getContent()->getPointer());
740-
auto end = begin + glUnspec->getContent()->getSize();
741-
std::string glsl(begin,end);
742-
asset::IShader::insertAfterVersionAndPragmaShaderStage(glsl,std::ostringstream()<<COpenGLShader::k_openGL2VulkanExtensionMap); // TODO: remove this eventually
743-
asset::IShader::insertDefines(glsl,m_physicalDevice->getExtraGLSLDefines());
744-
auto glslShader_woIncludes = m_physicalDevice->getGLSLCompiler()->resolveIncludeDirectives(glsl.c_str(), stage, glUnspec->getFilepathHint().c_str(), 4u, getLogger());
745-
spirv = m_physicalDevice->getGLSLCompiler()->compileSPIRVFromGLSL(
746-
reinterpret_cast<const char*>(glslShader_woIncludes->getContent()->getPointer()),
747-
stage,
748-
EP.c_str(),
749-
glUnspec->getFilepathHint().c_str(),
750-
true,
751-
nullptr,
752-
getLogger(),
753-
m_physicalDevice->getLimits().spirvVersion
754-
);
755-
756-
if (!spirv)
757-
return nullptr;
758-
}
759-
else
760-
{
761-
spirv = glUnspec->getSPVorGLSL_refctd();
762-
}
763-
764-
if (!spirv)
765-
return nullptr;
766-
767-
auto spvCPUShader = core::make_smart_refctd_ptr<asset::ICPUShader>(std::move(spirv), stage, contentType, std::string(_unspecialized->getFilepathHint()));
768-
769-
asset::CShaderIntrospector::SIntrospectionParams introspectionParams{_specInfo.entryPoint.c_str(),m_physicalDevice->getExtraGLSLDefines()};
770-
asset::CShaderIntrospector introspector(m_physicalDevice->getGLSLCompiler()); // TODO: shouldn't the introspection be cached for all calls to `createSpecializedShader` (or somehow embedded into the OpenGL pipeline cache?)
771-
const asset::CIntrospectionData* introspection = introspector.introspect(spvCPUShader.get(), introspectionParams);
772-
if (!introspection)
773-
{
774-
_NBL_DEBUG_BREAK_IF(true);
775-
getLogger().log("Unable to introspect the SPIR-V shader to extract information about bindings and push constants. Creation failed.", system::ILogger::ELL_ERROR);
776-
return nullptr;
777-
}
778-
779-
core::vector<COpenGLSpecializedShader::SUniform> uniformList;
780-
if (!COpenGLSpecializedShader::getUniformsFromPushConstants(&uniformList,introspection,getLogger().get()))
781-
{
782-
_NBL_DEBUG_BREAK_IF(true);
783-
getLogger().log("Attempted to create OpenGL GPU specialized shader from SPIR-V without debug info - unable to set push constants. Creation failed.", system::ILogger::ELL_ERROR);
784-
return nullptr;
785-
}
786-
787-
return core::make_smart_refctd_ptr<COpenGLSpecializedShader>(core::smart_refctd_ptr<IOpenGL_LogicalDevice>(this), m_glfeatures->ShaderLanguageVersion, spvCPUShader->getContent(), _specInfo, std::move(uniformList), stage);
729+
assert(false); // OpenGL backend officially killed
730+
return nullptr;
788731
}
789732
core::smart_refctd_ptr<IGPUBufferView> createBufferView_impl(IGPUBuffer* _underlying, asset::E_FORMAT _fmt, size_t _offset = 0ull, size_t _size = IGPUBufferView::whole_buffer) override final
790733
{
@@ -973,4 +916,4 @@ using COpenGLESLogicalDevice = COpenGL_LogicalDevice<COpenGLESQueue>;
973916

974917
}
975918

976-
#endif
919+
#endif

0 commit comments

Comments
 (0)