src/third_party/angle/src/libANGLE/renderer/vulkan/vk_caps_utils.cpp
// Generates a basic config for a combination of color format, depth stencil format and sample
// count.
Generates a basic config for a combination of color format, depth stencil format and sample
count.
Generates a basic config for a combination of color format depth stencil format and sample count .
egl::Config GenerateDefaultConfig(DisplayVk *display,
                                  const gl::InternalFormat &colorFormat,
                                  const gl::InternalFormat &depthStencilFormat,
                                  EGLint sampleCount)
{
    const RendererVk *renderer = display->getRenderer();
    const VkPhysicalDeviceProperties &physicalDeviceProperties =
        renderer->getPhysicalDeviceProperties();
    gl::Version maxSupportedESVersion = renderer->getMaxSupportedESVersion();
    EGLint es1Support = (maxSupportedESVersion.major >= 3 ? EGL_OPENGL_ES_BIT : 0);
    EGLint es2Support = (maxSupportedESVersion.major >= 2 ? EGL_OPENGL_ES2_BIT : 0);
    EGLint es3Support = (maxSupportedESVersion.major >= 3 ? EGL_OPENGL_ES3_BIT : 0);
    egl::Config config;
    config.renderTargetFormat = colorFormat.internalFormat;
    config.depthStencilFormat = depthStencilFormat.internalFormat;
    config.bufferSize         = colorFormat.pixelBytes * 8;
    config.redSize            = colorFormat.redBits;
    config.greenSize          = colorFormat.greenBits;
    config.blueSize           = colorFormat.blueBits;
    config.alphaSize          = colorFormat.alphaBits;
    config.alphaMaskSize      = 0;
    config.bindToTextureRGB   = colorFormat.format == GL_RGB;
    config.bindToTextureRGBA  = colorFormat.format == GL_RGBA || colorFormat.format == GL_BGRA_EXT;
    config.colorBufferType    = EGL_RGB_BUFFER;
    config.configCaveat       = GetConfigCaveat(colorFormat.internalFormat);
    config.conformant         = es1Support | es2Support | es3Support;
    config.depthSize          = depthStencilFormat.depthBits;
    config.stencilSize        = depthStencilFormat.stencilBits;
    config.level              = 0;
    config.matchNativePixmap  = EGL_NONE;
    config.maxPBufferWidth    = physicalDeviceProperties.limits.maxImageDimension2D;
    config.maxPBufferHeight   = physicalDeviceProperties.limits.maxImageDimension2D;
    config.maxPBufferPixels   = ComputeMaximumPBufferPixels(physicalDeviceProperties);
    config.maxSwapInterval    = 1;
    config.minSwapInterval    = 0;
    config.nativeRenderable   = EGL_TRUE;
    config.nativeVisualID     = static_cast<EGLint>(GetNativeVisualID(colorFormat));
    config.nativeVisualType   = EGL_NONE;
    config.renderableType     = es1Support | es2Support | es3Support;
    config.sampleBuffers      = (sampleCount > 0) ? 1 : 0;
    config.samples            = sampleCount;
    config.surfaceType        = EGL_WINDOW_BIT | EGL_PBUFFER_BIT;
    config.optimalOrientation    = EGL_SURFACE_ORIENTATION_INVERT_Y_ANGLE;
    config.transparentType       = EGL_NONE;
    config.transparentRedValue   = 0;
    config.transparentGreenValue = 0;
    config.transparentBlueValue  = 0;
    config.colorComponentType =
        gl_egl::GLComponentTypeToEGLColorComponentType(colorFormat.componentType);
    display->checkConfigSupport(&config);
    return config;
}
egl :: Config GenerateDefaultConfig ( DisplayVk * display , const gl :: InternalFormat & colorFormat , const gl :: InternalFormat & depthStencilFormat , EGLint sampleCount ) { const RendererVk * renderer = display -> getRenderer ( ) ; const VkPhysicalDeviceProperties & physicalDeviceProperties = renderer -> getPhysicalDeviceProperties ( ) ; gl :: Version maxSupportedESVersion = renderer -> getMaxSupportedESVersion ( ) ; EGLint es1Support = ( maxSupportedESVersion . major >= 3 ? EGL_OPENGL_ES_BIT : 0 ) ; EGLint es2Support = ( maxSupportedESVersion . major >= 2 ? EGL_OPENGL_ES2_BIT : 0 ) ; EGLint es3Support = ( maxSupportedESVersion . major >= 3 ? EGL_OPENGL_ES3_BIT : 0 ) ; egl :: Config config ; config . renderTargetFormat = colorFormat . internalFormat ; config . depthStencilFormat = depthStencilFormat . internalFormat ; config . bufferSize = colorFormat . pixelBytes * 8 ; config . redSize = colorFormat . redBits ; config . greenSize = colorFormat . greenBits ; config . blueSize = colorFormat . blueBits ; config . alphaSize = colorFormat . alphaBits ; config . alphaMaskSize = 0 ; config . bindToTextureRGB = colorFormat . format == GL_RGB ; config . bindToTextureRGBA = colorFormat . format == GL_RGBA || colorFormat . format == GL_BGRA_EXT ; config . colorBufferType = EGL_RGB_BUFFER ; config . configCaveat = GetConfigCaveat ( colorFormat . internalFormat ) ; config . conformant = es1Support | es2Support | es3Support ; config . depthSize = depthStencilFormat . depthBits ; config . stencilSize = depthStencilFormat . stencilBits ; config . level = 0 ; config . matchNativePixmap = EGL_NONE ; config . maxPBufferWidth = physicalDeviceProperties . limits . maxImageDimension2D ; config . maxPBufferHeight = physicalDeviceProperties . limits . maxImageDimension2D ; config . maxPBufferPixels = ComputeMaximumPBufferPixels ( physicalDeviceProperties ) ; config . maxSwapInterval = 1 ; config . minSwapInterval = 0 ; config . nativeRenderable = EGL_TRUE ; config . nativeVisualID = static_cast < EGLint > ( GetNativeVisualID ( colorFormat ) ) ; config . nativeVisualType = EGL_NONE ; config . renderableType = es1Support | es2Support | es3Support ; config . sampleBuffers = ( sampleCount > 0 ) ? 1 : 0 ; config . samples = sampleCount ; config . surfaceType = EGL_WINDOW_BIT | EGL_PBUFFER_BIT ; config . optimalOrientation = EGL_SURFACE_ORIENTATION_INVERT_Y_ANGLE ; config . transparentType = EGL_NONE ; config . transparentRedValue = 0 ; config . transparentGreenValue = 0 ; config . transparentBlueValue = 0 ; config . colorComponentType = gl_egl :: GLComponentTypeToEGLColorComponentType ( colorFormat . componentType ) ; display -> checkConfigSupport ( & config ) ; return config ; }
Generates a basic config for a combination of color format, depth stencil format and sample
count.
Generates a basic config for a combination of color format depth stencil format and sample count .
// ES3 features are required to emulate ES1 // Vulkan surfaces use a different origin than OpenGL, always prefer to be flipped vertically if // possible. // Vulkan always supports off-screen rendering.  Check the config with display to see if it can // also have window support.  If not, the following call should automatically remove // EGL_WINDOW_BIT.