5 #include "flutter/testing/testing.h"
6 #include "gtest/gtest.h"
9 #include "impeller/renderer/backend/gles/test/mock_gles.h"
17 TEST(BufferBindingsGLESTest, BindUniformData) {
19 absl::flat_hash_map<std::string, GLint> uniform_bindings;
20 uniform_bindings[
"SHADERMETADATA.FOOBAR"] = 1;
21 bindings.SetUniformBindings(std::move(uniform_bindings));
22 auto mock_gles_impl = std::make_unique<MockGLESImpl>();
24 EXPECT_CALL(*mock_gles_impl, Uniform1fv(_, _, _)).Times(1);
26 std::shared_ptr<MockGLES> mock_gl = MockGLES::Init(std::move(mock_gles_impl));
27 std::vector<BufferResource> bound_buffers;
28 std::vector<TextureAndSampler> bound_textures;
31 .
name =
"shader_metadata",
35 .size =
sizeof(float),
36 .byte_length =
sizeof(
float),
37 .array_elements = 0}}};
38 std::shared_ptr<ReactorGLES> reactor;
39 std::shared_ptr<Allocation> backing_store = std::make_shared<Allocation>();
40 ASSERT_TRUE(backing_store->Truncate(
Bytes{sizeof(float)}));
42 reactor, backing_store);
46 EXPECT_TRUE(bindings.
BindUniformData(mock_gl->GetProcTable(), bound_textures,
47 bound_buffers,
Range{0, 0},
51 TEST(BufferBindingsGLESTest, BindArrayData) {
53 absl::flat_hash_map<std::string, GLint> uniform_bindings;
54 uniform_bindings[
"SHADERMETADATA.FOOBAR[0]"] = 1;
55 bindings.SetUniformBindings(std::move(uniform_bindings));
56 auto mock_gles_impl = std::make_unique<MockGLESImpl>();
58 EXPECT_CALL(*mock_gles_impl, Uniform1fv(_, _, _)).Times(1);
60 std::shared_ptr<MockGLES> mock_gl = MockGLES::Init(std::move(mock_gles_impl));
61 std::vector<BufferResource> bound_buffers;
62 std::vector<TextureAndSampler> bound_textures;
65 .
name =
"shader_metadata",
69 .size =
sizeof(float),
70 .byte_length =
sizeof(
float) * 4,
71 .array_elements = 4}}};
72 std::shared_ptr<ReactorGLES> reactor;
73 std::shared_ptr<Allocation> backing_store = std::make_shared<Allocation>();
74 ASSERT_TRUE(backing_store->Truncate(
Bytes{sizeof(float) * 4}));
81 EXPECT_TRUE(bindings.
BindUniformData(mock_gl->GetProcTable(), bound_textures,
82 bound_buffers,
Range{0, 0},
Sets up stage bindings for single draw call in the OpenGLES backend.
bool BindUniformData(const ProcTableGLES &gl, const std::vector< TextureAndSampler > &bound_textures, const std::vector< BufferResource > &bound_buffers, Range texture_range, Range buffer_range)
TEST(AllocationSizeTest, CanCreateTypedAllocations)
Resource< BufferView > BufferResource