Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/drape
diff options
context:
space:
mode:
authorr.kuznetsov <r.kuznetsov@corp.mail.ru>2019-01-18 17:03:07 +0300
committerDaria Volvenkova <d.volvenkova@corp.mail.ru>2019-03-01 10:45:24 +0300
commitf53013310a9ce31e976e7bae78461e57b12cc0d2 (patch)
treec4534e4209e7411771401542ccc82db631349190 /drape
parentc1375c8dac6c5d027d62f010042056b5cddd8c08 (diff)
[drape] Refactored context access in textures, fixed iOS compilation
Diffstat (limited to 'drape')
-rw-r--r--drape/drape_tests/font_texture_tests.cpp4
-rw-r--r--drape/drape_tests/texture_of_colors_tests.cpp14
-rw-r--r--drape/dynamic_texture.hpp8
-rw-r--r--drape/font_texture.cpp4
-rw-r--r--drape/font_texture.hpp2
-rw-r--r--drape/hw_texture.cpp9
-rw-r--r--drape/hw_texture.hpp12
-rw-r--r--drape/hw_texture_ios.hpp5
-rw-r--r--drape/hw_texture_ios.mm6
-rw-r--r--drape/metal/metal_texture.hpp5
-rw-r--r--drape/metal/metal_texture.mm4
-rw-r--r--drape/render_state.cpp4
-rw-r--r--drape/stipple_pen_resource.cpp4
-rw-r--r--drape/stipple_pen_resource.hpp2
-rw-r--r--drape/texture.cpp10
-rw-r--r--drape/texture.hpp6
-rw-r--r--drape/texture_of_colors.cpp4
-rw-r--r--drape/texture_of_colors.hpp2
-rw-r--r--drape/vulkan/vulkan_texture.cpp12
-rw-r--r--drape/vulkan/vulkan_texture.hpp8
20 files changed, 70 insertions, 55 deletions
diff --git a/drape/drape_tests/font_texture_tests.cpp b/drape/drape_tests/font_texture_tests.cpp
index 3bbdfb34c7..b6f9eca021 100644
--- a/drape/drape_tests/font_texture_tests.cpp
+++ b/drape/drape_tests/font_texture_tests.cpp
@@ -114,7 +114,7 @@ UNIT_TEST(UploadingGlyphs)
tex.Create(make_ref(&context), p);
EXPECTGL(glTexSubImage2D(_, _, _, _, _, _, _))
.WillRepeatedly(Invoke(&r, &UploadedRender::glMemoryToQImage));
- index.UploadResources(make_ref(&tex));
+ index.UploadResources(make_ref(&context), make_ref(&tex));
count = 0;
count += (index.MapResource(GlyphKey(0x68, GlyphManager::kDynamicGlyphSize)) != nullptr) ? 1 : 0;
@@ -128,7 +128,7 @@ UNIT_TEST(UploadingGlyphs)
EXPECTGL(glTexSubImage2D(_, _, _, _, _, _, _))
.WillRepeatedly(Invoke(&r, &UploadedRender::glMemoryToQImage));
- index.UploadResources(make_ref(&tex));
+ index.UploadResources(make_ref(&context), make_ref(&tex));
RunTestLoop("UploadingGlyphs", std::bind(&UploadedRender::Render, &r, _1));
DrapeRoutine::Shutdown();
diff --git a/drape/drape_tests/texture_of_colors_tests.cpp b/drape/drape_tests/texture_of_colors_tests.cpp
index 40667db35d..bf581f564e 100644
--- a/drape/drape_tests/texture_of_colors_tests.cpp
+++ b/drape/drape_tests/texture_of_colors_tests.cpp
@@ -104,7 +104,7 @@ UNIT_TEST(ColorPalleteUploadingSingleRow)
DummyTexture texture;
texture.Create(make_ref(&context), p);
DummyColorPallete cp(m2::PointU(width, height));
- cp.UploadResources(make_ref(&texture));
+ cp.UploadResources(make_ref(&context), make_ref(&texture));
{
cp.MapResource(dp::ColorKey(dp::Color(0xFF, 0, 0, 0)));
@@ -142,7 +142,7 @@ UNIT_TEST(ColorPalleteUploadingSingleRow)
EXPECTGL(glTexSubImage2D(0, 0, 10, 2, AnyOf(gl_const::GLRGBA, gl_const::GLRGBA8), gl_const::GL8BitOnChannel, _))
.WillOnce(Invoke(&cmp, &MemoryComparer::cmpSubImage));
- cp.UploadResources(make_ref(&texture));
+ cp.UploadResources(make_ref(&context), make_ref(&texture));
}
{
@@ -181,7 +181,7 @@ UNIT_TEST(ColorPalleteUploadingSingleRow)
EXPECTGL(glTexSubImage2D(10, 0, 10, 2, AnyOf(gl_const::GLRGBA, gl_const::GLRGBA8), gl_const::GL8BitOnChannel, _))
.WillOnce(Invoke(&cmp, &MemoryComparer::cmpSubImage));
- cp.UploadResources(make_ref(&texture));
+ cp.UploadResources(make_ref(&context), make_ref(&texture));
}
EXPECTGL(glDeleteTexture(1));
@@ -226,7 +226,7 @@ UNIT_TEST(ColorPalleteUploadingPartialyRow)
EXPECTGL(glTexSubImage2D(0, 0, 4, 2, AnyOf(gl_const::GLRGBA, gl_const::GLRGBA8), gl_const::GL8BitOnChannel, _))
.WillOnce(Invoke(&cmp, &MemoryComparer::cmpSubImage));
- cp.UploadResources(make_ref(&texture));
+ cp.UploadResources(make_ref(&context), make_ref(&texture));
}
{
@@ -269,7 +269,7 @@ UNIT_TEST(ColorPalleteUploadingPartialyRow)
EXPECTGL(glTexSubImage2D(0, 2, 4, 2, AnyOf(gl_const::GLRGBA, gl_const::GLRGBA8), gl_const::GL8BitOnChannel, _))
.WillOnce(Invoke(&cmp2, &MemoryComparer::cmpSubImage));
- cp.UploadResources(make_ref(&texture));
+ cp.UploadResources(make_ref(&context), make_ref(&texture));
}
@@ -316,7 +316,7 @@ UNIT_TEST(ColorPalleteUploadingMultiplyRow)
EXPECTGL(glTexSubImage2D(0, 0, 4, 2, AnyOf(gl_const::GLRGBA, gl_const::GLRGBA8), gl_const::GL8BitOnChannel, _))
.WillOnce(Invoke(&cmp, &MemoryComparer::cmpSubImage));
- cp.UploadResources(make_ref(&texture));
+ cp.UploadResources(make_ref(&context), make_ref(&texture));
}
{
@@ -352,7 +352,7 @@ UNIT_TEST(ColorPalleteUploadingMultiplyRow)
EXPECTGL(glTexSubImage2D(0, 2, 4, 4, AnyOf(gl_const::GLRGBA, gl_const::GLRGBA8), gl_const::GL8BitOnChannel, _))
.WillOnce(Invoke(&cmp1, &MemoryComparer::cmpSubImage));
- cp.UploadResources(make_ref(&texture));
+ cp.UploadResources(make_ref(&context), make_ref(&texture));
}
EXPECTGL(glDeleteTexture(1));
diff --git a/drape/dynamic_texture.hpp b/drape/dynamic_texture.hpp
index 3ae46646d2..e19dd00c83 100644
--- a/drape/dynamic_texture.hpp
+++ b/drape/dynamic_texture.hpp
@@ -51,8 +51,8 @@ public:
}
ASSERT(m_indexer != nullptr, ());
- Bind();
- m_indexer->UploadResources(make_ref(this));
+ Bind(context);
+ m_indexer->UploadResources(context, make_ref(this));
}
TextureFormat GetFormat() const override
@@ -85,10 +85,10 @@ public:
return m_isInitialized ? Texture::GetID() : 0;
}
- void Bind() const override
+ void Bind(ref_ptr<dp::GraphicsContext> context) const override
{
if (m_isInitialized)
- Texture::Bind();
+ Texture::Bind(context);
}
void SetFilter(TextureFilter filter) override
diff --git a/drape/font_texture.cpp b/drape/font_texture.cpp
index 5f623056c7..17a5fb9bf4 100644
--- a/drape/font_texture.cpp
+++ b/drape/font_texture.cpp
@@ -214,7 +214,7 @@ void GlyphIndex::OnCompleteGlyphGeneration(GlyphGenerator::GlyphGenerationDataAr
m_pendingNodes.emplace_back(g.m_rect, g.m_glyph);
}
-void GlyphIndex::UploadResources(ref_ptr<Texture> texture)
+void GlyphIndex::UploadResources(ref_ptr<dp::GraphicsContext> context, ref_ptr<Texture> texture)
{
PendingNodes pendingNodes;
{
@@ -251,7 +251,7 @@ void GlyphIndex::UploadResources(ref_ptr<Texture> texture)
ASSERT_EQUAL(glyph.m_image.m_height, rect.SizeY(), ());
uint8_t * srcMemory = SharedBufferManager::GetRawPointer(glyph.m_image.m_data);
- texture->UploadData(zeroPoint.x, zeroPoint.y, rect.SizeX(), rect.SizeY(), make_ref(srcMemory));
+ texture->UploadData(context, zeroPoint.x, zeroPoint.y, rect.SizeX(), rect.SizeY(), make_ref(srcMemory));
glyph.m_image.Destroy();
}
diff --git a/drape/font_texture.hpp b/drape/font_texture.hpp
index e5aac49c89..adda3040da 100644
--- a/drape/font_texture.hpp
+++ b/drape/font_texture.hpp
@@ -84,7 +84,7 @@ public:
ref_ptr<Texture::ResourceInfo> MapResource(GlyphKey const & key, bool & newResource);
std::vector<ref_ptr<Texture::ResourceInfo>> MapResources(std::vector<GlyphKey> const & keys,
bool & hasNewResources);
- void UploadResources(ref_ptr<Texture> texture);
+ void UploadResources(ref_ptr<dp::GraphicsContext> context, ref_ptr<Texture> texture);
bool CanBeGlyphPacked(uint32_t glyphsCount) const;
diff --git a/drape/hw_texture.cpp b/drape/hw_texture.cpp
index 241f1413a7..ea4fd5734d 100644
--- a/drape/hw_texture.cpp
+++ b/drape/hw_texture.cpp
@@ -174,7 +174,7 @@ void OpenGLHWTexture::Create(ref_ptr<dp::GraphicsContext> context, Params const
Base::Create(context, params, data);
m_textureID = GLFunctions::glGenTexture();
- Bind();
+ Bind(context);
UnpackFormat(context, m_params.m_format, m_unpackedLayout, m_unpackedPixelType);
@@ -199,8 +199,8 @@ void OpenGLHWTexture::Create(ref_ptr<dp::GraphicsContext> context, Params const
GLFunctions::glFlush();
}
-void OpenGLHWTexture::UploadData(uint32_t x, uint32_t y, uint32_t width, uint32_t height,
- ref_ptr<void> data)
+void OpenGLHWTexture::UploadData(ref_ptr<dp::GraphicsContext> context, uint32_t x, uint32_t y,
+ uint32_t width, uint32_t height, ref_ptr<void> data)
{
ASSERT(Validate(), ());
uint32_t const mappingSize = height * width * m_pixelBufferElementSize;
@@ -218,8 +218,9 @@ void OpenGLHWTexture::UploadData(uint32_t x, uint32_t y, uint32_t width, uint32_
}
}
-void OpenGLHWTexture::Bind() const
+void OpenGLHWTexture::Bind(ref_ptr<dp::GraphicsContext> context) const
{
+ UNUSED_VALUE(context);
ASSERT(Validate(), ());
if (m_textureID != 0)
GLFunctions::glBindTexture(GetID());
diff --git a/drape/hw_texture.hpp b/drape/hw_texture.hpp
index f780550897..09287a23b0 100644
--- a/drape/hw_texture.hpp
+++ b/drape/hw_texture.hpp
@@ -35,10 +35,10 @@ public:
virtual void Create(ref_ptr<dp::GraphicsContext> context, Params const & params,
ref_ptr<void> data) = 0;
- virtual void UploadData(uint32_t x, uint32_t y, uint32_t width, uint32_t height,
- ref_ptr<void> data) = 0;
+ virtual void UploadData(ref_ptr<dp::GraphicsContext> context, uint32_t x, uint32_t y,
+ uint32_t width, uint32_t height, ref_ptr<void> data) = 0;
- virtual void Bind() const = 0;
+ virtual void Bind(ref_ptr<dp::GraphicsContext> context) const = 0;
// For OpenGL the texture must be bound before calling this method.
virtual void SetFilter(TextureFilter filter) = 0;
@@ -80,9 +80,9 @@ public:
~OpenGLHWTexture() override;
void Create(ref_ptr<dp::GraphicsContext> context, Params const & params,
ref_ptr<void> data) override;
- void UploadData(uint32_t x, uint32_t y, uint32_t width, uint32_t height,
- ref_ptr<void> data) override;
- void Bind() const override;
+ void UploadData(ref_ptr<dp::GraphicsContext> context, uint32_t x, uint32_t y,
+ uint32_t width, uint32_t height, ref_ptr<void> data) override;
+ void Bind(ref_ptr<dp::GraphicsContext> context) const override;
void SetFilter(TextureFilter filter) override;
bool Validate() const override;
diff --git a/drape/hw_texture_ios.hpp b/drape/hw_texture_ios.hpp
index b6d52d6441..8d76be2524 100644
--- a/drape/hw_texture_ios.hpp
+++ b/drape/hw_texture_ios.hpp
@@ -47,8 +47,9 @@ public:
~HWTextureApple();
void Create(ref_ptr<dp::GraphicsContext> context, Params const & params, ref_ptr<void> data) override;
- void UploadData(uint32_t x, uint32_t y, uint32_t width, uint32_t height, ref_ptr<void> data) override;
- void Bind() const override;
+ void UploadData(ref_ptr<dp::GraphicsContext> context, uint32_t x, uint32_t y,
+ uint32_t width, uint32_t height, ref_ptr<void> data) override;
+ void Bind(ref_ptr<dp::GraphicsContext> context) const override;
void SetFilter(TextureFilter filter) override;
bool Validate() const override;
diff --git a/drape/hw_texture_ios.mm b/drape/hw_texture_ios.mm
index 17a9526f80..fb992423c2 100644
--- a/drape/hw_texture_ios.mm
+++ b/drape/hw_texture_ios.mm
@@ -171,7 +171,8 @@ void HWTextureApple::Create(ref_ptr<dp::GraphicsContext> context, Params const &
Unlock();
}
-void HWTextureApple::UploadData(uint32_t x, uint32_t y, uint32_t width, uint32_t height, ref_ptr<void> data)
+void HWTextureApple::UploadData(ref_ptr<dp::GraphicsContext> context, uint32_t x, uint32_t y,
+ uint32_t width, uint32_t height, ref_ptr<void> data)
{
uint8_t bytesPerPixel = GetBytesPerPixel(GetFormat());
Lock();
@@ -197,8 +198,9 @@ void HWTextureApple::UploadData(uint32_t x, uint32_t y, uint32_t width, uint32_t
Unlock();
}
-void HWTextureApple::Bind() const
+void HWTextureApple::Bind(ref_ptr<dp::GraphicsContext> context) const
{
+ UNUSED_VALUE(context);
ASSERT(Validate(), ());
if (m_textureID != 0)
GLFunctions::glBindTexture(GetID());
diff --git a/drape/metal/metal_texture.hpp b/drape/metal/metal_texture.hpp
index d2771f2334..4ca3435e8e 100644
--- a/drape/metal/metal_texture.hpp
+++ b/drape/metal/metal_texture.hpp
@@ -22,8 +22,9 @@ public:
explicit MetalTexture(ref_ptr<MetalTextureAllocator> allocator);
void Create(ref_ptr<dp::GraphicsContext> context, Params const & params, ref_ptr<void> data) override;
- void UploadData(uint32_t x, uint32_t y, uint32_t width, uint32_t height, ref_ptr<void> data) override;
- void Bind() const override {}
+ void UploadData(ref_ptr<dp::GraphicsContext> context, uint32_t x, uint32_t y,
+ uint32_t width, uint32_t height, ref_ptr<void> data) override;
+ void Bind(ref_ptr<dp::GraphicsContext> context) const override {}
void SetFilter(TextureFilter filter) override;
bool Validate() const override;
diff --git a/drape/metal/metal_texture.mm b/drape/metal/metal_texture.mm
index 7f63646af6..7cb06e393f 100644
--- a/drape/metal/metal_texture.mm
+++ b/drape/metal/metal_texture.mm
@@ -76,8 +76,10 @@ void MetalTexture::Create(ref_ptr<dp::GraphicsContext> context, Params const & p
}
}
-void MetalTexture::UploadData(uint32_t x, uint32_t y, uint32_t width, uint32_t height, ref_ptr<void> data)
+void MetalTexture::UploadData(ref_ptr<dp::GraphicsContext> context, uint32_t x, uint32_t y,
+ uint32_t width, uint32_t height, ref_ptr<void> data)
{
+ UNUSED_VALUE(context);
CHECK(m_isMutable, ("Upload data is avaivable only for mutable textures."));
MTLRegion region = MTLRegionMake2D(x, y, width, height);
auto const rowBytes = width * GetBytesPerPixel(m_params.m_format);
diff --git a/drape/render_state.cpp b/drape/render_state.cpp
index 93ab82baa8..77055cb9d2 100644
--- a/drape/render_state.cpp
+++ b/drape/render_state.cpp
@@ -210,7 +210,7 @@ void TextureState::ApplyTextures(ref_ptr<GraphicsContext> context, RenderState c
if (tex != nullptr && (texLoc = p->GetUniformLocation(texture.first)) >= 0)
{
GLFunctions::glActiveTexture(gl_const::GLTexture0 + m_usedSlots);
- tex->Bind();
+ tex->Bind(context);
GLFunctions::glUniformValuei(texLoc, m_usedSlots);
tex->SetFilter(state.GetTextureFilter());
m_usedSlots++;
@@ -225,7 +225,7 @@ void TextureState::ApplyTextures(ref_ptr<GraphicsContext> context, RenderState c
}
else if (apiVersion == dp::ApiVersion::Vulkan)
{
- //TODO(@rokuz, @darina): Implement.
+ //TODO(@rokuz, @darina): Implement. Use Bind!
}
else
{
diff --git a/drape/stipple_pen_resource.cpp b/drape/stipple_pen_resource.cpp
index 0e6d67f6da..68d4b18b7c 100644
--- a/drape/stipple_pen_resource.cpp
+++ b/drape/stipple_pen_resource.cpp
@@ -164,7 +164,7 @@ ref_ptr<Texture::ResourceInfo> StipplePenIndex::MapResource(StipplePenKey const
return ReserveResource(false /* predefined */, key, newResource);
}
-void StipplePenIndex::UploadResources(ref_ptr<Texture> texture)
+void StipplePenIndex::UploadResources(ref_ptr<dp::GraphicsContext> context, ref_ptr<Texture> texture)
{
ASSERT(texture->GetFormat() == dp::TextureFormat::Alpha, ());
TPendingNodes pendingNodes;
@@ -184,7 +184,7 @@ void StipplePenIndex::UploadResources(ref_ptr<Texture> texture)
for (size_t i = 0; i < pendingNodes.size(); ++i)
pendingNodes[i].second.Rasterize(rawBuffer + i * bytesPerNode);
- texture->UploadData(0, pendingNodes.front().first.minY(), kMaxStipplePenLength,
+ texture->UploadData(context, 0, pendingNodes.front().first.minY(), kMaxStipplePenLength,
static_cast<uint32_t>(pendingNodes.size()) * kStippleHeight, make_ref(rawBuffer));
mng.freeSharedBuffer(reserveBufferSize, ptr);
diff --git a/drape/stipple_pen_resource.hpp b/drape/stipple_pen_resource.hpp
index 31ef3c846f..230d64f499 100644
--- a/drape/stipple_pen_resource.hpp
+++ b/drape/stipple_pen_resource.hpp
@@ -101,7 +101,7 @@ public:
ref_ptr<Texture::ResourceInfo> ReserveResource(bool predefined, StipplePenKey const & key,
bool & newResource);
ref_ptr<Texture::ResourceInfo> MapResource(StipplePenKey const & key, bool & newResource);
- void UploadResources(ref_ptr<Texture> texture);
+ void UploadResources(ref_ptr<dp::GraphicsContext> context, ref_ptr<Texture> texture);
private:
typedef std::map<StipplePenHandle, StipplePenResourceInfo> TResourceMapping;
diff --git a/drape/texture.cpp b/drape/texture.cpp
index a74c15b5fb..5bf19c87f8 100644
--- a/drape/texture.cpp
+++ b/drape/texture.cpp
@@ -29,11 +29,11 @@ void Texture::Create(ref_ptr<dp::GraphicsContext> context, Params const & params
m_hwTexture->Create(context, params, data);
}
-void Texture::UploadData(uint32_t x, uint32_t y, uint32_t width, uint32_t height,
- ref_ptr<void> data)
+void Texture::UploadData(ref_ptr<dp::GraphicsContext> context, uint32_t x, uint32_t y,
+ uint32_t width, uint32_t height, ref_ptr<void> data)
{
ASSERT(m_hwTexture != nullptr, ());
- m_hwTexture->UploadData(x, y, width, height, data);
+ m_hwTexture->UploadData(context, x, y, width, height, data);
}
TextureFormat Texture::GetFormat() const
@@ -72,10 +72,10 @@ uint32_t Texture::GetID() const
return m_hwTexture->GetID();
}
-void Texture::Bind() const
+void Texture::Bind(ref_ptr<dp::GraphicsContext> context) const
{
ASSERT(m_hwTexture != nullptr, ());
- m_hwTexture->Bind();
+ m_hwTexture->Bind(context);
}
void Texture::SetFilter(TextureFilter filter)
diff --git a/drape/texture.hpp b/drape/texture.hpp
index aede9bbfcb..fd6ecff9b4 100644
--- a/drape/texture.hpp
+++ b/drape/texture.hpp
@@ -59,7 +59,7 @@ public:
virtual float GetT(uint32_t y) const;
virtual uint32_t GetID() const;
- virtual void Bind() const;
+ virtual void Bind(ref_ptr<dp::GraphicsContext> context) const;
// Texture must be bound before calling this method.
virtual void SetFilter(TextureFilter filter);
@@ -67,8 +67,8 @@ public:
virtual void Create(ref_ptr<dp::GraphicsContext> context, Params const & params);
virtual void Create(ref_ptr<dp::GraphicsContext> context, Params const & params,
ref_ptr<void> data);
- void UploadData(uint32_t x, uint32_t y, uint32_t width, uint32_t height,
- ref_ptr<void> data);
+ void UploadData(ref_ptr<dp::GraphicsContext> context, uint32_t x, uint32_t y,
+ uint32_t width, uint32_t height, ref_ptr<void> data);
ref_ptr<HWTexture> GetHardwareTexture() const;
diff --git a/drape/texture_of_colors.cpp b/drape/texture_of_colors.cpp
index 124afacc03..09e3081dd7 100644
--- a/drape/texture_of_colors.cpp
+++ b/drape/texture_of_colors.cpp
@@ -70,7 +70,7 @@ ref_ptr<Texture::ResourceInfo> ColorPalette::MapResource(ColorKey const & key, b
return ReserveResource(false /* predefined */, key, newResource);
}
-void ColorPalette::UploadResources(ref_ptr<Texture> texture)
+void ColorPalette::UploadResources(ref_ptr<dp::GraphicsContext> context, ref_ptr<Texture> texture)
{
ASSERT(texture->GetFormat() == dp::TextureFormat::RGBA8, ());
buffer_vector<PendingColor, 16> pendingNodes;
@@ -159,7 +159,7 @@ void ColorPalette::UploadResources(ref_ptr<Texture> texture)
}
pointer = SharedBufferManager::GetRawPointer(buffer);
- texture->UploadData(uploadRect.minX(), uploadRect.minY(),
+ texture->UploadData(context, uploadRect.minX(), uploadRect.minY(),
uploadRect.SizeX(), uploadRect.SizeY(), make_ref(pointer));
}
}
diff --git a/drape/texture_of_colors.hpp b/drape/texture_of_colors.hpp
index 01c4b8f4ec..e1269bebbc 100644
--- a/drape/texture_of_colors.hpp
+++ b/drape/texture_of_colors.hpp
@@ -34,7 +34,7 @@ public:
ref_ptr<Texture::ResourceInfo> ReserveResource(bool predefined, ColorKey const & key, bool & newResource);
ref_ptr<Texture::ResourceInfo> MapResource(ColorKey const & key, bool & newResource);
- void UploadResources(ref_ptr<Texture> texture);
+ void UploadResources(ref_ptr<dp::GraphicsContext> context, ref_ptr<Texture> texture);
void SetIsDebug(bool isDebug) { m_isDebug = isDebug; }
diff --git a/drape/vulkan/vulkan_texture.cpp b/drape/vulkan/vulkan_texture.cpp
index 6a3b79aaf7..de2eae2283 100644
--- a/drape/vulkan/vulkan_texture.cpp
+++ b/drape/vulkan/vulkan_texture.cpp
@@ -64,7 +64,7 @@ void VulkanTexture::Create(ref_ptr<dp::GraphicsContext> context, Params const &
auto const format = UnpackFormat(params.m_format);
VkFormatProperties formatProperties;
vkGetPhysicalDeviceFormatProperties(vulkanContext->GetPhysicalDevice(), format, &formatProperties);
- CHECK(formatProperties.linearTilingFeatures & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT, ());
+ CHECK(formatProperties.optimalTilingFeatures & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT, ());
m_isMutable = params.m_isMutable;
if (params.m_isRenderTarget)
@@ -86,7 +86,8 @@ void VulkanTexture::Create(ref_ptr<dp::GraphicsContext> context, Params const &
}
}
-void VulkanTexture::UploadData(uint32_t x, uint32_t y, uint32_t width, uint32_t height, ref_ptr<void> data)
+void VulkanTexture::UploadData(ref_ptr<dp::GraphicsContext> context, uint32_t x, uint32_t y,
+ uint32_t width, uint32_t height, ref_ptr<void> data)
{
CHECK(m_isMutable, ("Upload data is avaivable only for mutable textures."));
CHECK(false, ());
@@ -95,6 +96,11 @@ void VulkanTexture::UploadData(uint32_t x, uint32_t y, uint32_t width, uint32_t
// [m_texture replaceRegion:region mipmapLevel:0 withBytes:data.get() bytesPerRow:rowBytes];
}
+void VulkanTexture::Bind(ref_ptr<dp::GraphicsContext> context) const
+{
+
+}
+
void VulkanTexture::SetFilter(TextureFilter filter)
{
m_params.m_filter = filter;
@@ -102,7 +108,7 @@ void VulkanTexture::SetFilter(TextureFilter filter)
bool VulkanTexture::Validate() const
{
- return m_texture != nullptr && m_textureView != nullptr;
+ return m_texture != 0 && m_textureView != 0;
}
} // namespace vulkan
} // namespace dp
diff --git a/drape/vulkan/vulkan_texture.hpp b/drape/vulkan/vulkan_texture.hpp
index 493c370609..280f7e9dac 100644
--- a/drape/vulkan/vulkan_texture.hpp
+++ b/drape/vulkan/vulkan_texture.hpp
@@ -27,9 +27,11 @@ public:
explicit VulkanTexture(ref_ptr<VulkanTextureAllocator> allocator);
~VulkanTexture() override;
- void Create(ref_ptr<dp::GraphicsContext> context, Params const & params, ref_ptr<void> data) override;
- void UploadData(uint32_t x, uint32_t y, uint32_t width, uint32_t height, ref_ptr<void> data) override;
- void Bind() const override {}
+ void Create(ref_ptr<dp::GraphicsContext> context, Params const & params,
+ ref_ptr<void> data) override;
+ void UploadData(ref_ptr<dp::GraphicsContext> context, uint32_t x, uint32_t y, uint32_t width,
+ uint32_t height, ref_ptr<void> data) override;
+ void Bind(ref_ptr<dp::GraphicsContext> context) const override;
void SetFilter(TextureFilter filter) override;
bool Validate() const override;