Program Listing for File opengl-framebuffer-guard.h

Return to documentation for file (include\gpu-utility\opengl-framebuffer-guard.h)

/******************************************************************************
(c) Intel Corporation.

This software and the related documents are Intel copyrighted materials,
and your use of them is governed by the express license under which they
were provided to you ("License"). Unless the License provides otherwise,
you may not use, modify, copy, publish, distribute, disclose or transmit
this software or the related documents without Intel's prior written
permission.

 This software and the related documents are provided as is, with no express
or implied warranties, other than those that are expressly stated in the
License.

******************************************************************************/

#pragma once

#include <gpu-utility/opengl-context.h>
#include <dispatch-table/dispatch-table.h>

namespace gpa {
namespace gpu_utility {

struct ReadPixelGuard
{
    ReadPixelGuard(const GLContext& context, GLint packAligment = 4);
    ReadPixelGuard(ReadPixelGuard const&) = delete;
    ReadPixelGuard& operator=(ReadPixelGuard const&) = delete;
    ~ReadPixelGuard();

protected:
    const GLContext& mContext;

private:
    GLuint mOrigPixelPackBuffer = 0;
    GLint mDesiredPackAligment = 0;
    GLint mOrigPackSwapBytes = 0;
    GLint mOrigPackLsbFirst = 0;
    GLint mOrigPackAligment = 0;
    GLint mOrigPackRowLength = 0;
    GLint mOrigPackImageHeight = 0;
    GLint mOrigPackSkipPixels = 0;
    GLint mOrigPackSkipRows = 0;
    GLint mOrigPackSkipImages = 0;
    GLint mOrigPackRowBytesApple = 0;
};

struct OrigFramebufferGuard : public ReadPixelGuard
{
    OrigFramebufferGuard(const GLContext& context, GLint packAligment = 4);

    ~OrigFramebufferGuard();

private:
    GLenum mOverrideTarget = GL_FRAMEBUFFER;
    GLuint mOrigReadBuffer = 0;
    bool mIsES11 = false;
};

}  // namespace gpu_utility
}  // namespace gpa