forked from flutter/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Impeller] GLES: Keep track of OpenGL ES device capabilities. (flutte…
- Loading branch information
1 parent
45f74b5
commit bdb713c
Showing
11 changed files
with
210 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
// Copyright 2013 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "impeller/renderer/backend/gles/capabilities_gles.h" | ||
|
||
#include "impeller/renderer/backend/gles/proc_table_gles.h" | ||
|
||
namespace impeller { | ||
|
||
CapabilitiesGLES::CapabilitiesGLES(const ProcTableGLES& gl) { | ||
{ | ||
GLint value = 0; | ||
gl.GetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &value); | ||
max_combined_texture_image_units = value; | ||
} | ||
|
||
{ | ||
GLint value = 0; | ||
gl.GetIntegerv(GL_MAX_CUBE_MAP_TEXTURE_SIZE, &value); | ||
max_cube_map_texture_size = value; | ||
} | ||
|
||
if (gl.GetDescription()->IsES()) { | ||
GLint value = 0; | ||
gl.GetIntegerv(GL_MAX_FRAGMENT_UNIFORM_VECTORS, &value); | ||
max_fragment_uniform_vectors = value; | ||
} | ||
|
||
{ | ||
GLint value = 0; | ||
gl.GetIntegerv(GL_MAX_RENDERBUFFER_SIZE, &value); | ||
max_renderbuffer_size = value; | ||
} | ||
|
||
{ | ||
GLint value = 0; | ||
gl.GetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &value); | ||
max_texture_image_units = value; | ||
} | ||
|
||
{ | ||
GLint value = 0; | ||
gl.GetIntegerv(GL_MAX_TEXTURE_SIZE, &value); | ||
max_texture_size = ISize{value, value}; | ||
} | ||
|
||
if (gl.GetDescription()->IsES()) { | ||
GLint value = 0; | ||
gl.GetIntegerv(GL_MAX_VARYING_VECTORS, &value); | ||
max_varying_vectors = value; | ||
} | ||
|
||
{ | ||
GLint value = 0; | ||
gl.GetIntegerv(GL_MAX_VERTEX_ATTRIBS, &value); | ||
max_vertex_attribs = value; | ||
} | ||
|
||
{ | ||
GLint value = 0; | ||
gl.GetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, &value); | ||
max_vertex_texture_image_units = value; | ||
} | ||
|
||
if (gl.GetDescription()->IsES()) { | ||
GLint value = 0; | ||
gl.GetIntegerv(GL_MAX_VERTEX_UNIFORM_VECTORS, &value); | ||
max_vertex_uniform_vectors = value; | ||
} | ||
|
||
{ | ||
GLint values[2] = {}; | ||
gl.GetIntegerv(GL_MAX_VIEWPORT_DIMS, values); | ||
max_viewport_dims = ISize{values[0], values[1]}; | ||
} | ||
|
||
{ | ||
GLint value = 0; | ||
gl.GetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &value); | ||
num_compressed_texture_formats = value; | ||
} | ||
|
||
if (gl.GetDescription()->IsES()) { | ||
GLint value = 0; | ||
gl.GetIntegerv(GL_NUM_SHADER_BINARY_FORMATS, &value); | ||
num_shader_binary_formats = value; | ||
} | ||
} | ||
|
||
size_t CapabilitiesGLES::GetMaxTextureUnits(ShaderStage stage) const { | ||
switch (stage) { | ||
case ShaderStage::kVertex: | ||
return max_vertex_texture_image_units; | ||
case ShaderStage::kFragment: | ||
return max_texture_image_units; | ||
case ShaderStage::kUnknown: | ||
case ShaderStage::kTessellationControl: | ||
case ShaderStage::kTessellationEvaluation: | ||
case ShaderStage::kCompute: | ||
return 0u; | ||
} | ||
FML_UNREACHABLE(); | ||
} | ||
|
||
} // namespace impeller |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// Copyright 2013 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#pragma once | ||
|
||
#include <cstddef> | ||
|
||
#include "flutter/fml/macros.h" | ||
#include "impeller/geometry/size.h" | ||
#include "impeller/renderer/shader_types.h" | ||
|
||
namespace impeller { | ||
|
||
class ProcTableGLES; | ||
|
||
struct CapabilitiesGLES { | ||
CapabilitiesGLES(const ProcTableGLES& gl); | ||
|
||
// Must be at least 8. | ||
size_t max_combined_texture_image_units = 8; | ||
|
||
// Must be at least 16. | ||
size_t max_cube_map_texture_size = 16; | ||
|
||
// Must be at least 16. | ||
size_t max_fragment_uniform_vectors = 16; | ||
|
||
// Must be at least 1. | ||
size_t max_renderbuffer_size = 1; | ||
|
||
// Must be at least 8. | ||
size_t max_texture_image_units = 8; | ||
|
||
// Must be at least 64. | ||
ISize max_texture_size = ISize{64, 64}; | ||
|
||
// Must be at least 8. | ||
size_t max_varying_vectors = 8; | ||
|
||
// Must be at least 8. | ||
size_t max_vertex_attribs = 8; | ||
|
||
// May be 0. | ||
size_t max_vertex_texture_image_units = 0; | ||
|
||
// Must be at least 128. | ||
size_t max_vertex_uniform_vectors = 128; | ||
|
||
// Must be at least display size. | ||
ISize max_viewport_dims; | ||
|
||
// May be 0. | ||
size_t num_compressed_texture_formats = 0; | ||
|
||
// May be 0. | ||
size_t num_shader_binary_formats = 0; | ||
|
||
size_t GetMaxTextureUnits(ShaderStage stage) const; | ||
}; | ||
|
||
} // namespace impeller |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters