Optimize fixed-function Vulkan shaders for Adreno 512 and recover Android surfaces

This commit is contained in:
shen
2026-09-30 21:48:07 -07:00
parent 1e4762ccf4
commit 922954dd97
17 changed files with 238 additions and 32 deletions
+9 -2
View File
@@ -14,6 +14,7 @@
#include <cstddef>
#include <cstdint>
#include <functional>
#include <map>
#include <string>
#include <unordered_map>
#include <vector>
@@ -201,6 +202,7 @@ public:
std::size_t texture_upload_count() const { return texture_upload_count_; }
std::size_t texture_uploaded_bytes() const { return texture_uploaded_bytes_; }
const std::string& device_name() const { return device_name_; }
bool prefer_saver_default() const { return prefer_saver_default_; }
const char* present_mode_name() const;
Timings timings() const { return timings_; }
native_perf::RendererTotals perf_totals() const;
@@ -322,7 +324,8 @@ private:
// offscreen: for offscreen_pass_ (single-sampled render-target texture) instead of pass_.
VkPipeline get_pipeline(std::uint8_t cull, std::uint8_t depth, std::uint8_t blend,
bool lines = false, std::uint8_t z_func = 4, bool offscreen = false);
bool lines = false, std::uint8_t z_func = 4, bool offscreen = false,
const Render3DDraw* draw = nullptr);
VkDescriptorSet allocate_texture_descriptor_set(VkImageView view0, VkImageView view1,
VkSampler sampler0 = VK_NULL_HANDLE,
@@ -395,7 +398,9 @@ private:
VkDevice device_ = VK_NULL_HANDLE;
VkQueue queue_ = VK_NULL_HANDLE;
std::uint32_t queue_family_ = 0;
bool surface_lost_ = false;
std::string device_name_;
bool prefer_saver_default_ = false;
VkSwapchainKHR swapchain_ = VK_NULL_HANDLE;
VkFormat swapchain_format_ = VK_FORMAT_UNDEFINED;
VkExtent2D extent_{};
@@ -491,7 +496,9 @@ private:
VkShaderModule vertex_module_ = VK_NULL_HANDLE;
VkShaderModule fragment_module_ = VK_NULL_HANDLE;
VkPipelineLayout layout_ = VK_NULL_HANDLE;
std::unordered_map<std::uint32_t, VkPipeline> pipelines_;
// Raster state followed by the exact fragment specialization values; no hash-only
// identity, so different stage programs can never alias the same pipeline.
std::map<std::array<std::uint32_t, 17>, VkPipeline> pipelines_;
std::unordered_map<GeometryId, Geometry, GeometryIdHash> geometries_;
std::uint64_t frame_number_ = 0;
std::uint64_t timed_frames_ = 0;