<commit_before>#include <storm/platform/ogl/framebuffer_ogl.h>

#include <numeric>

#include <storm/platform/ogl/check_result_ogl.h>
#include <storm/platform/ogl/rendering_system_ogl.h>
#include <storm/platform/ogl/texture_ogl.h>

namespace storm {

FramebufferHandleOgl::FramebufferHandleOgl() {
    ::glGenFramebuffers( 1, &_handle );
    checkResult( "::glGenFramebuffers" );
}

FramebufferHandleOgl::~FramebufferHandleOgl() {
    ::glDeleteFramebuffers( 1, &_handle );
}

ScopeFramebufferBinding::ScopeFramebufferBinding( GLuint binding ) {
    ::glGetIntegerv( GL_FRAMEBUFFER_BINDING, &_previousBinding );
    checkResult( "::glGetIntegerv" );

    ::glBindFramebuffer( GL_FRAMEBUFFER, binding );
    checkResult( "::glBindFramebuffer" );
}

ScopeFramebufferBinding::~ScopeFramebufferBinding() {
    ::glBindFramebuffer( GL_FRAMEBUFFER, _previousBinding );
}

FramebufferOgl::FramebufferOgl( const Description &description ) :
    _description( description )
{
    ScopeFramebufferBinding scopeFramebufferBinding( _handle );

    size_t colorAttachmentsNumber = 0;

    for( const auto &buffer : description.buffers ) {
        const auto nativeTexture =
            std::static_pointer_cast<TextureOgl>( buffer.texture );

        GLenum attachment;
        switch( nativeTexture->getDescription().format ) {
        case Texture::Format::DepthNormUint16:
        case Texture::Format::DepthNormUint24:
        case Texture::Format::DepthNormUint32:
        case Texture::Format::DepthFloat32:
            attachment = GL_DEPTH_ATTACHMENT;
            break;
        case Texture::Format::DepthNormUint24StencilUint8:
            attachment = GL_DEPTH_STENCIL_ATTACHMENT;
            break;
        default:
            attachment = GL_COLOR_ATTACHMENT0 + (colorAttachmentsNumber++);
            break;
        }
<commit_msg>Added assertions, which prevent possible attempts to create a framebuffer with multiple depth buffers<commit_after>#include <storm/platform/ogl/framebuffer_ogl.h>

#include <numeric>

#include <storm/platform/ogl/check_result_ogl.h>
#include <storm/platform/ogl/rendering_system_ogl.h>
#include <storm/platform/ogl/texture_ogl.h>

namespace storm {

FramebufferHandleOgl::FramebufferHandleOgl() {
    ::glGenFramebuffers( 1, &_handle );
    checkResult( "::glGenFramebuffers" );
}

FramebufferHandleOgl::~FramebufferHandleOgl() {
    ::glDeleteFramebuffers( 1, &_handle );
}

ScopeFramebufferBinding::ScopeFramebufferBinding( GLuint binding ) {
    ::glGetIntegerv( GL_FRAMEBUFFER_BINDING, &_previousBinding );
    checkResult( "::glGetIntegerv" );

    ::glBindFramebuffer( GL_FRAMEBUFFER, binding );
    checkResult( "::glBindFramebuffer" );
}

ScopeFramebufferBinding::~ScopeFramebufferBinding() {
    ::glBindFramebuffer( GL_FRAMEBUFFER, _previousBinding );
}

FramebufferOgl::FramebufferOgl( const Description &description ) :
    _description( description )
{
    ScopeFramebufferBinding scopeFramebufferBinding( _handle );

    size_t colorAttachmentsNumber = 0;
    size_t depthAttachmentsNumber = 0;

    for( const auto &buffer : description.buffers ) {
        const auto nativeTexture =
            std::static_pointer_cast<TextureOgl>( buffer.texture );

        GLenum attachment;
        switch( nativeTexture->getDescription().format ) {
        case Texture::Format::DepthNormUint16:
        case Texture::Format::DepthNormUint24:
        case Texture::Format::DepthNormUint32:
        case Texture::Format::DepthFloat32:
            storm_assert( depthAttachmentsNumber == 0 );
            ++depthAttachmentsNumber;
            attachment = GL_DEPTH_ATTACHMENT;
            break;

        case Texture::Format::DepthNormUint24StencilUint8:
            storm_assert( depthAttachmentsNumber == 0 );
            ++depthAttachmentsNumber;
            attachment = GL_DEPTH_STENCIL_ATTACHMENT;
            break;

        default:
            attachment = GL_COLOR_ATTACHMENT0 + (colorAttachmentsNumber++);
            break;
        }

{'fraction_non_alphanumeric': 0.102235619191158, 'fraction_numerical': 0.008289374529012811, 'mean_word_length': 3.8799019607843137, 'pattern_counts': {'":': 6, '<': 15, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '965993', 'n_tokens_mistral': 1203, 'n_tokens_neox': 1150, 'n_words': 196}