TDME2 1.9.121
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
VKRenderer.h
Go to the documentation of this file.
1#pragma once
2
3#if defined(_MSC_VER)
4 // this suppresses a warning redefinition of APIENTRY macro
5 #define NOMINMAX
6 #include <windows.h>
7#endif
8#define GLFW_INCLUDE_VULKAN
9#include <GLFW/glfw3.h>
10
11#include <ext/vulkan/spirv/GlslangToSpv.h>
12#include <ext/vulkan/svs/thsvs_simpler_vulkan_synchronization.h>
13#include <ext/vulkan/vma/src/VmaUsage.h>
14
15#include <array>
16#include <list>
17#include <string>
18#include <unordered_map>
19#include <unordered_set>
20#include <vector>
21
22#include <tdme/tdme.h>
28#include <tdme/math/fwd-tdme.h>
33
34#if defined(CPU_64BIT) && defined(_MSC_VER)
35 #include <ext/windows-msc/uint128_t/uint128_t.h>
36#endif
37
38using std::array;
39using std::list;
40using std::string;
41using std::unordered_map;
42using std::unordered_set;
43using std::vector;
44
59
60#if defined(CPU_64BIT)
61 #define SAMPLER_HASH_MAX 8
62 #if defined(_MSC_VER)
63 #define SAMPLER_HASH_TYPE uint128_t
64 struct UINT128_T_Hash {
65 std::size_t operator()(uint128_t m) const {
66 std::hash<uint64_t> hashVal;
67 return hashVal(m.lower() + m.upper()); // TODO: implement me properly
68 }
69 };
70 #else
71 #define SAMPLER_HASH_TYPE __int128
72 #endif
73#else
74 #define SAMPLER_HASH_MAX 4
75 #define SAMPLER_HASH_TYPE uint64_t
76#endif
77
78/**
79 * Vulkan renderer
80 * @author Andreas Drewke
81 * @version $Id$
82 */
84 : public Renderer
85{
87private:
88 static constexpr bool VERBOSE { false };
89 static constexpr int DRAW_COMMANDBUFFER_MAX { 3 };
90 static constexpr int SHADERSSTAGES_MAX { 2 };
91 static constexpr int TEXTUREUNITS_MAX { 16 };
92 static constexpr int SHADERS_MAX { 100 };
93 static constexpr int SHADERS_COMPUTE_MAX { 1 };
94 static constexpr int COMMANDS_MAX { 16 };
95 static constexpr int COMMANDS_MAX_GRAPHICS { 16 };
96 static constexpr int COMMANDS_MAX_COMPUTE { 5 };
97 static constexpr int DESC_MAX_UNCACHED { COMMANDS_MAX };
98 static constexpr int DESC_MAX_CACHED { 512 }; // TODO: make this dynamic
99 static constexpr int OBJECTS_VERTEX_BUFFER_COUNT { 10 };
100 static constexpr int POINTS_VERTEX_BUFFER_COUNT { 9 };
101 static constexpr int LINES_VERTEX_BUFFER_COUNT { 4 };
102 static constexpr int COMPUTE_STORAGE_BUFFER_COUNT { 8 };
103 static constexpr int BUFFERS_MAX { 65535 };
104 static constexpr int TEXTURES_MAX { 65535 };
105 static constexpr int PROGRAMS_MAX { 128 };
106
107 static constexpr int CUBEMAPTEXTUREINDEX_MIN { 1 };
108
110 VkBuffer buffer;
111 VmaAllocation allocation;
112 };
113
115 VkImage image;
116 VmaAllocation allocation;
117 VkImageView imageView;
118 VkSampler sampler;
119 };
120
123 bool memoryMappable { false };
124 int64_t frameUsedLast { -1 };
125 VkBuffer buf { VK_NULL_HANDLE };
126 VmaAllocation allocation { VK_NULL_HANDLE };
127 uint32_t size { 0 };
128 };
129 int32_t id { 0 };
130 bool useGPUMemory { false };
131 bool shared { false };
132 list<reusable_buffer> buffers;
133 vector<reusable_buffer*> frameFreeBuffers;
134 uint32_t bufferCount { 0 };
135 int64_t frameUsedLast { -1LL };
136 int64_t frameCleanedLast { -1LL };
139 volatile bool uploading { false };
140 };
141
144 VkBuffer buffer { VK_NULL_HANDLE };
145 VmaAllocation allocation { VK_NULL_HANDLE };
146 };
147 int bufferIdx { 0 };
148 int size { -1 };
149 vector<uint8_t> uniformBufferData;
150 // TODO: make them a growing list
151 array<uniform_buffer_type_buffer, COMMANDS_MAX_GRAPHICS * DRAW_COMMANDBUFFER_MAX * 5> buffers;
152 };
153
154 struct shader_type {
156 string name;
157 string type;
158 uint8_t location;
159 };
162 string name;
163 string newName;
165 int32_t position;
166 uint32_t size;
167 int32_t textureUnit;
168 };
169 vector<attribute_layout> attributeLayouts;
170 unordered_map<string, uniform_type*> uniforms;
171 vector<uniform_type*> uniformList;
172 vector<uniform_type*> samplerUniformList;
173 uint32_t uboSize { 0 };
174 uint32_t samplers { 0 };
175 int32_t maxBindings { -1 };
176 vector<uniform_buffer_type> uniformBuffers;
177 int32_t uboBindingIdx { -1 };
179 string source;
180 string file;
181 string cacheId;
182 string hash;
183 vector<uint32_t> spirv;
184 bool valid;
185 int32_t id { 0 };
186 VkShaderStageFlagBits type;
187 VkShaderModule module { VK_NULL_HANDLE };
188 };
189
191 uint64_t id { 0 };
192 uint32_t width { 0 };
193 uint32_t height { 0 };
194 uint32_t frameBufferId { 0 };
195 array<VkPipeline, 32768> pipelines;
196 };
197
202 array<VkDescriptorSet, DESC_MAX_UNCACHED> uboDescriptorSets;
203 array<VkDescriptorSet, DESC_MAX_UNCACHED> texturesDescriptorSetsUncached;
204 };
205 struct context {
207 array<VkDescriptorSet, DESC_MAX_CACHED> descriptorSets2; // TODO: rename those fuckers
208 #if defined(CPU_64BIT) && defined(_MSC_VER)
209 unordered_map<SAMPLER_HASH_TYPE, int, UINT128_T_Hash> texturesDescriptorSetsCache;
210 unordered_map<int32_t, unordered_set<SAMPLER_HASH_TYPE, UINT128_T_Hash>> texturesDescriptorSetsCacheTextureIds;
211 #else
212 unordered_map<SAMPLER_HASH_TYPE, int> texturesDescriptorSetsCache;
213 unordered_map<int32_t, unordered_set<SAMPLER_HASH_TYPE>> texturesDescriptorSetsCacheTextureIds;
214 #endif
216 array<command_buffer, DRAW_COMMANDBUFFER_MAX> commandBuffers;
217 };
218 int type { 0 };
219 // TODO: clear on viewport dimension change
220 vector<int32_t> shaderIds;
221 vector<shader_type*> shaders;
222 unordered_map<int32_t, string> uniforms;
223 uint32_t layoutBindings { 0 };
224 VkPipelineLayout pipelineLayout { VK_NULL_HANDLE };
225 VkDescriptorSetLayout uboDescriptorSetLayout { VK_NULL_HANDLE };
226 VkDescriptorSetLayout texturesDescriptorSetLayout { VK_NULL_HANDLE };
227 int32_t id { 0 };
228 vector<context> contexts;
229 };
230
232 bool valid { false };
233 VkPipelineStageFlags srcStages { 0 };
234 VkPipelineStageFlags dstStages { 0 };
235 VkImageMemoryBarrier vkImageMemoryBarrier {};
236 array<ThsvsAccessType, 2> accessTypes { THSVS_ACCESS_NONE, THSVS_ACCESS_NONE };
237 ThsvsImageLayout svsLayout { THSVS_IMAGE_LAYOUT_GENERAL };
238 VkImageLayout vkLayout { VK_IMAGE_LAYOUT_UNDEFINED };
239 };
240
243 volatile bool uploaded { false };
245 int32_t id { 0 };
246 uint32_t width { 0 };
247 uint32_t height { 0 };
248 VkFormat format { VK_FORMAT_UNDEFINED };
249 VkSampler sampler { VK_NULL_HANDLE };
250 VkImage image { VK_NULL_HANDLE };
251 VkImageAspectFlags aspectMask { 0 };
252 array<array<ThsvsAccessType, 2>, 6> accessTypes
253 {{
254 { THSVS_ACCESS_NONE, THSVS_ACCESS_NONE },
255 { THSVS_ACCESS_NONE, THSVS_ACCESS_NONE },
256 { THSVS_ACCESS_NONE, THSVS_ACCESS_NONE },
257 { THSVS_ACCESS_NONE, THSVS_ACCESS_NONE },
258 { THSVS_ACCESS_NONE, THSVS_ACCESS_NONE },
259 { THSVS_ACCESS_NONE, THSVS_ACCESS_NONE }
260 }};
261 ThsvsImageLayout svsLayout { THSVS_IMAGE_LAYOUT_OPTIMAL };
262 VkImageLayout vkLayout { VK_IMAGE_LAYOUT_UNDEFINED };
263 VmaAllocation allocation { VK_NULL_HANDLE };
264 VkImageView view { VK_NULL_HANDLE };
265 // this texture points to a cube map color buffer/depth buffer
266 // as cube map frame buffer color buffer and cube map frame buffer depth buffer are pseudo textures
267 // only providing views and samplers, but not image itself
269 int32_t cubemapTextureIndex { 0 };
270 // the cube map itself has a attached color buffer and depth buffer
273 //
274 int32_t frameBufferObjectId { 0 };
277 //
279 };
280
283 int32_t id { 0 };
285 int32_t depthTextureId { 0 };
286 int32_t colorTextureId { 0 };
287 int32_t cubemapTextureId { 0 };
288 int32_t cubemapTextureIndex { 0 };
289 int32_t depthBufferTextureId { 0 };
298 VkFramebuffer frameBuffer { VK_NULL_HANDLE };
299 VkRenderPass renderPass { VK_NULL_HANDLE };
300 };
301
303 array<ThsvsAccessType, 2> accessTypes { THSVS_ACCESS_NONE, THSVS_ACCESS_NONE };
304 ThsvsImageLayout svsLayout { THSVS_IMAGE_LAYOUT_OPTIMAL };
305 VkImage image { VK_NULL_HANDLE };
306 VkImageView view { VK_NULL_HANDLE };
307 VkFramebuffer framebuffer { VK_NULL_HANDLE };
308 int width { -1 };
309 int height { -1 };
310 };
311
314 VkCommandBuffer drawCommand;
315 VkFence drawFence;
317 };
318
319 int32_t idx { 0 };
320
321 VkCommandPool setupCommandPool;
322 VkCommandBuffer setupCommandInUse;
323 VkCommandBuffer setupCommand;
324 VkFence setupFence;
325
327
328 VkCommandPool drawCommandPool;
330 program_type* program { nullptr };
331
332 //
333 uint16_t pipelineIdx;
334 VkPipeline pipeline { VK_NULL_HANDLE };
335
336 //
337 array<command_buffer, DRAW_COMMANDBUFFER_MAX> commandBuffers;
338
339 //
340 array<VkDescriptorBufferInfo, TEXTUREUNITS_MAX + SHADERSSTAGES_MAX> descriptorBufferInfos;
341 array<VkWriteDescriptorSet, TEXTUREUNITS_MAX + SHADERSSTAGES_MAX> descriptorWriteSets;
342 array<VkDescriptorImageInfo, TEXTUREUNITS_MAX + SHADERSSTAGES_MAX> descriptorImageInfos;
343
344 //
345 VkBuffer boundIndicesBuffer { VK_NULL_HANDLE };
346 array<VkBuffer, 10> boundBuffers {
347 VK_NULL_HANDLE, VK_NULL_HANDLE, VK_NULL_HANDLE, VK_NULL_HANDLE,
348 VK_NULL_HANDLE, VK_NULL_HANDLE, VK_NULL_HANDLE, VK_NULL_HANDLE,
349 VK_NULL_HANDLE, VK_NULL_HANDLE
350 };
351 array<VkDeviceSize, 10> boundBufferOffsets {
352 0, 0, 0, 0,
353 0, 0, 0, 0,
354 0, 0
355 };
356 array<uint32_t, 10> boundBufferSizes { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
357 int32_t activeTextureUnit { 0 };
359 int32_t id { 0 };
360 VkSampler sampler { VK_NULL_HANDLE };
361 VkImageView view { VK_NULL_HANDLE };
362 VkImageLayout layout { VK_IMAGE_LAYOUT_UNDEFINED };
363 };
364 array<bound_texture, TEXTUREUNITS_MAX> boundTextures;
365
367
368 uint32_t commandCount { 0 };
369
370 bool cullingEnabled { true };
371 int frontFace { VK_FRONT_FACE_COUNTER_CLOCKWISE + 1 };
372 int frontFaceIndex { VK_FRONT_FACE_COUNTER_CLOCKWISE + 1 };
373
374 unordered_set<int32_t> uploadedTextureIds;
375 };
376
377 VkSurfaceKHR surface { VK_NULL_HANDLE };
378
379 VkInstance instance { VK_NULL_HANDLE };
380 VkPhysicalDevice physicalDevice { VK_NULL_HANDLE };
381 VkDevice device { VK_NULL_HANDLE };
383 VkQueue queue { VK_NULL_HANDLE };
384 VkPhysicalDeviceProperties gpuProperties;
385 VkPhysicalDeviceFeatures gpuFeatures;
386 VkQueueFamilyProperties *queueProperties { nullptr };
387 VkPhysicalDeviceMemoryProperties memoryProperties;
389
390 PFN_vkGetPhysicalDeviceSurfaceSupportKHR fpGetPhysicalDeviceSurfaceSupportKHR { nullptr };
391 PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR fpGetPhysicalDeviceSurfaceCapabilitiesKHR { nullptr };
392 PFN_vkGetPhysicalDeviceSurfaceFormatsKHR fpGetPhysicalDeviceSurfaceFormatsKHR { nullptr };
393 PFN_vkGetPhysicalDeviceSurfacePresentModesKHR fpGetPhysicalDeviceSurfacePresentModesKHR { nullptr };
394 PFN_vkCreateSwapchainKHR fpCreateSwapchainKHR { nullptr };
395 PFN_vkDestroySwapchainKHR fpDestroySwapchainKHR { nullptr };
396 PFN_vkGetSwapchainImagesKHR fpGetSwapchainImagesKHR { nullptr };
397 PFN_vkAcquireNextImageKHR fpAcquireNextImageKHR { nullptr };
398 PFN_vkQueuePresentKHR fpQueuePresentKHR { nullptr };
399
401 VkSwapchainKHR windowSwapchain { VK_NULL_HANDLE };
402 vector<window_frambuffer_buffer_type> windowFramebufferBuffers;
405
409 vector<framebuffer_pipelines_type*> framebuffersPipelines;
410
411 VkRenderPass renderPass { VK_NULL_HANDLE };
412
413 int32_t shaderIdx { 1 };
414 int32_t bufferIdx { 1 };
415 int32_t textureIdx { 1 };
416 vector<program_type*> programVector { nullptr };
417 unordered_map<int32_t, shader_type*> shaders;
418 array<buffer_object_type*, BUFFERS_MAX + 1> buffers;
419 array<texture_type*, TEXTURES_MAX + 1> textures;
420 vector<int32_t> freeTextureIds;
421 vector<int32_t> freeBufferIds;
422 vector<framebuffer_object_type*> framebuffers { nullptr };
423
426
427 uint32_t windowWidth { 0 };
428 uint32_t windowHeight { 0 };
429 VkFormat windowFormat { VK_FORMAT_UNDEFINED };
430 VkColorSpaceKHR windowColorSpace { VK_COLOR_SPACE_SRGB_NONLINEAR_KHR };
431
439
440 VkDescriptorPool descriptorPool1 { VK_NULL_HANDLE };
441 VkDescriptorPool descriptorPool2 { VK_NULL_HANDLE };
442
443 uint32_t queueCount { 0 };
444
445 VkSemaphore imageAcquiredSemaphore { VK_NULL_HANDLE };
446 VkSemaphore drawCompleteSemaphore { VK_NULL_HANDLE };
447
448 float clearRed { 0.0f };
449 float clearGreen { 0.0f };
450 float clearBlue { 0.0f };
451 float clearAlpha { 1.0f };
452
453 VkViewport viewport;
454 VkRect2D scissor;
455
456 int32_t boundFrameBufferId { 0 };
457
460 VkCullModeFlagBits cullMode { VK_CULL_MODE_FRONT_BIT};
461 bool depthBufferWriting { true };
462 bool depthBufferTesting { true };
463 int depthFunction { VK_COMPARE_OP_LESS_OR_EQUAL };
464 float lineWidth { 1.0f };
465 int64_t frame { 0 };
466
468 vector<delete_buffer_type> deleteBuffers;
469 vector<delete_image_type> deleteImages;
470
472 vector<int32_t> disposeTextures;
473 vector<int32_t> disposeBuffers;
474 vector<VkPipeline> disposePipelines;
475
476 VmaAllocator vmaAllocator { VK_NULL_HANDLE };
478
479 vector<context_type> contexts;
480 vector<VkFence> contextsDrawFences;
481
483
484 VkPresentModeKHR swapchainPresentMode { VK_PRESENT_MODE_IMMEDIATE_KHR };
485 VkPresentModeKHR lastSwapchainPresentMode { VK_PRESENT_MODE_IMMEDIATE_KHR };
486 bool vSync { false };
487
488 //
489 VkBool32 checkLayers(uint32_t checkCount, const char **checkNames, const vector<VkLayerProperties>& instanceLayers);
490 void setImageLayout(int contextIdx, texture_type* textureObject, const array<ThsvsAccessType,2>& nextAccessTypes, ThsvsImageLayout nextLayout, bool discardContent, uint32_t baseMipLevel = 0, uint32_t levelCount = 1, bool submit = true);
492 image_layout_change& imageLayoutChange,
493 texture_type* textureObject,
494 const array<ThsvsAccessType,2>& prevAccessTypes,
495 const array<ThsvsAccessType,2>& nextAccessTypes,
496 ThsvsImageLayout prevLayout,
497 ThsvsImageLayout nextLayout,
498 bool discardContent,
499 uint32_t baseMipLevel = 0,
500 uint32_t levelCount = 1
501 );
502 void applyImageLayoutChange(int contextIdx, const image_layout_change& imageLayoutChange, texture_type* textureObject, bool submit = true);
503 void applyImageLayoutChanges(int contextIdx, const array<image_layout_change, 8> imageLayoutChanges, array<texture_type*, 8> textureObjects, bool submit = true);
504 void setImageLayout2(int contextIdx, texture_type* textureObject, const array<ThsvsAccessType,2>& accessTypes, const array<ThsvsAccessType,2>& nextAccessTypes, ThsvsImageLayout layout, ThsvsImageLayout nextLayout, bool discardContent, uint32_t baseMipLevel, uint32_t levelCount, uint32_t baseArrayLayer, uint32_t layerCount, bool updateTextureObject);
505 void setImageLayout3(int contextIdx, VkImage image, VkImageAspectFlags aspectMask, const array<ThsvsAccessType,2>& accessTypes, const array<ThsvsAccessType,2>& nextAccessTypes, ThsvsImageLayout layout, ThsvsImageLayout nextLayout);
506 uint32_t getMipLevels(Texture* texture);
507 void prepareTextureImage(int contextIdx, struct texture_type* textureObject, VkImageTiling tiling, VkImageUsageFlags usage, VkFlags requiredFlags, Texture* texture, const array<ThsvsAccessType,2>& nextAccesses, ThsvsImageLayout imageLayout, bool disableMipMaps = true, uint32_t baseLevel = 0, uint32_t levelCount = 1);
508 VkBuffer getBindBufferObjectInternal(int32_t bufferObjectId, uint32_t& size);
509 void createBuffer(VkDeviceSize size, VkBufferUsageFlags usage, VkMemoryPropertyFlags properties, VkBuffer& buffer, VmaAllocation& allocation, VmaAllocationInfo& allocationInfo);
510 buffer_object_type* getBufferObjectInternal(int32_t bufferObjectId);
511 void vmaMemCpy(VmaAllocation allocationDst, const uint8_t* src, uint32_t size, uint32_t offset = 0);
512 void uploadBufferObjectInternal(int contextIdx, buffer_object_type* buffer, int32_t size, const uint8_t* data, VkBufferUsageFlagBits usage);
513 void uploadBufferObjectInternal(int contextIdx, int32_t bufferObjectId, int32_t size, const uint8_t* data, VkBufferUsageFlagBits usage);
514 texture_type* getTextureInternal(int32_t textureId);
515 texture_type* getBindTextureInternal(int32_t textureId);
516 framebuffer_pipelines_type* getFramebufferPipelines(uint64_t framebufferPipelinesId);
517 framebuffer_pipelines_type* createFramebufferPipelines(uint64_t framebufferPipelinesId);
518 VkPipeline getPipelineInternal(int contextIdx, program_type* programm, uint64_t framebuffePipelineId, uint32_t pipelineIdx);
519 void setProgramUniformInternal(int contextIdx, int32_t uniformId, uint8_t* data, int32_t size);
520 void initializeSwapChain();
523 void requestSubmitDrawBuffers(int contextIdx);
525 void startRenderPass(int contextIdx);
526 void endRenderPass(int contextIdx);
527 void createRenderProgram(program_type* program);
528 void createObjectsRenderingPipeline(int contextIdx, program_type* program);
529 void setupObjectsRenderingPipeline(int contextIdx, program_type* program);
530 void createPointsRenderingPipeline(int contextIdx, program_type* program);
531 void setupPointsRenderingPipeline(int contextIdx, program_type* program);
532 void createLinesRenderingPipeline(int contextIdx, program_type* program);
533 void setupLinesRenderingPipeline(int contextIdx, program_type* program);
534 void createSkinningComputingProgram(program_type* program);
535 void setupSkinningComputingPipeline(int contextIdx, program_type* program);
536 void unsetPipeline(int contextIdx);
537 void prepareSetupCommandBuffer(int contextIdx);
538 void finishSetupCommandBuffer(int contextIdx);
540 void reshape();
541 void createRasterizationStateCreateInfo(int contextIdx, VkPipelineRasterizationStateCreateInfo& rasterizationStateCreateInfo);
542 void createColorBlendAttachmentState(VkPipelineColorBlendAttachmentState& blendAttachmentState);
543 void createDepthStencilStateCreateInfo(VkPipelineDepthStencilStateCreateInfo& depthStencilStateCreateInfo);
545 uint16_t createPipelineIndex(program_type* program, int contextIdx);
546 void createDepthBufferTexture(int32_t textureId, int32_t width, int32_t height, int32_t cubeMapTextureId, int32_t cubeMapTextureIndex);
547 void createBufferTexture(int32_t textureId, int32_t width, int32_t height, int32_t cubeMapTextureId, int32_t cubeMapTextureIndex, VkFormat format);
548 void drawInstancedTrianglesFromBufferObjects(int contextIdx, int32_t triangles, int32_t trianglesOffset, VkBuffer indicesBuffer, int32_t instances);
549 void createFramebufferObject(int32_t frameBufferId);
550 bool beginDrawCommandBuffer(int contextIdx, int bufferId = -1);
551 VkCommandBuffer endDrawCommandBuffer(int contextIdx, int bufferId = -1, bool cycleBuffers = true);
552 void submitDrawCommandBuffers(int commandBufferCount, VkCommandBuffer* commandBuffers, VkFence& fence);
553 void uploadCubeMapSingleTexture(int contextIdx, texture_type* cubemapTextureType, Texture* texture, uint32_t baseArrayLayer);
554 void finishRendering();
555 void invalidateTextureDescriptorCaches(int textureId);
556 void invalidatePipelines();
557
558protected:
559 /**
560 * Protected constructor
561 */
562 VKRenderer();
563
564public:
565 const string getVendor() override;
566 const string getRenderer() override;
567 const string getShaderVersion() override;
568 void initialize() override;
569 void initializeFrame() override;
570 void finishFrame() override;
572 bool isBufferObjectsAvailable() override;
573 bool isDepthTextureAvailable() override;
574 bool isUsingProgramAttributeLocation() override;
576 bool isSpecularMappingAvailable() override;
577 bool isNormalMappingAvailable() override;
578 bool isInstancedRenderingAvailable() override;
579 bool isPBRAvailable() override;
580 bool isComputeShaderAvailable() override;
581 bool isGLCLAvailable() override;
582 bool isUsingShortIndices() override;
583 bool isDeferredShadingAvailable() override;
584 int32_t getTextureUnits() override;
585 int32_t loadShader(int32_t type, const string& pathName, const string& fileName, const string& definitions = string(), const string& functions = string()) override;
586 void useProgram(int contextIdx, int32_t programId) override;
587 int32_t createProgram(int type) override;
588 void attachShaderToProgram(int32_t programId, int32_t shaderId) override;
589 bool linkProgram(int32_t programId) override;
590 int32_t getProgramUniformLocation(int32_t programId, const string& name) override;
591 void setProgramUniformInteger(int contextIdx, int32_t uniformId, int32_t value) override;
592 void setProgramUniformFloat(int contextIdx, int32_t uniformId, float value) override;
593 void setProgramUniformFloatMatrix3x3(int contextIdx, int32_t uniformId, const array<float, 9>& data) override;
594 void setProgramUniformFloatMatrix4x4(int contextIdx, int32_t uniformId, const array<float, 16>& data) override;
595 void setProgramUniformFloatMatrices4x4(int contextIdx, int32_t uniformId, int32_t count, FloatBuffer* data) override;
596 void setProgramUniformFloatVec4(int contextIdx, int32_t uniformId, const array<float, 4>& data) override;
597 void setProgramUniformFloatVec3(int contextIdx, int32_t uniformId, const array<float, 3>& data) override;
598 void setProgramUniformFloatVec2(int contextIdx, int32_t uniformId, const array<float, 2>& data) override;
599 void setProgramAttributeLocation(int32_t programId, int32_t location, const string& name) override;
600 void setViewPort(int32_t width, int32_t height) override;
601 void updateViewPort() override;
602 void setClearColor(float red, float green, float blue, float alpha) override;
603 void enableCulling(int contextIdx) override;
604 void disableCulling(int contextIdx) override;
605 void setFrontFace(int contextIdx, int32_t frontFace) override;
606 void setCullFace(int32_t cullFace) override;
607 void enableBlending() override;
608 void enableAdditionBlending() override;
609 void disableBlending() override;
610 void enableDepthBufferWriting() override;
611 void disableDepthBufferWriting() override;
612 void disableDepthBufferTest() override;
613 void enableDepthBufferTest() override;
614 void setDepthFunction(int32_t depthFunction) override;
615 void setColorMask(bool red, bool green, bool blue, bool alpha) override;
616 void clear(int32_t mask) override;
617 int32_t createTexture() override;
618 int32_t createDepthBufferTexture(int32_t width, int32_t height, int32_t cubeMapTextureId, int32_t cubeMapTextureIndex) override;
619 int32_t createColorBufferTexture(int32_t width, int32_t height, int32_t cubeMapTextureId, int32_t cubeMapTextureIndex) override;
620 int32_t createGBufferGeometryTexture(int32_t width, int32_t height) override;
621 int32_t createGBufferColorTexture(int32_t width, int32_t height) override;
622 void uploadTexture(int contextIdx, Texture* texture) override;
623 void uploadCubeMapTexture(int contextIdx, Texture* textureLeft, Texture* textureRight, Texture* textureTop, Texture* textureBottom, Texture* textureFront, Texture* textureBack) override;
624 int32_t createCubeMapTexture(int contextIdx, int32_t width, int32_t height) override;
625 void resizeDepthBufferTexture(int32_t textureId, int32_t width, int32_t height) override;
626 void resizeColorBufferTexture(int32_t textureId, int32_t width, int32_t height) override;
627 void resizeGBufferGeometryTexture(int32_t textureId, int32_t width, int32_t height) override;
628 void resizeGBufferColorTexture(int32_t textureId, int32_t width, int32_t height) override;
629 void bindTexture(int contextIdx, int32_t textureId) override;
630 void bindCubeMapTexture(int contextIdx, int32_t textureId) override;
631 void disposeTexture(int32_t textureId) override;
632 int32_t createFramebufferObject(int32_t depthBufferTextureId, int32_t colorBufferTextureId, int32_t cubeMapTextureId = 0, int32_t cubeMapTextureIndex = 0) override;
634 int32_t depthBufferTextureId,
635 int32_t geometryBufferTextureId1,
636 int32_t geometryBufferTextureId2,
637 int32_t geometryBufferTextureId3,
638 int32_t colorBufferTextureId1,
639 int32_t colorBufferTextureId2,
640 int32_t colorBufferTextureId3,
641 int32_t colorBufferTextureId4,
642 int32_t colorBufferTextureId5
643 ) override;
644 void bindFrameBuffer(int32_t frameBufferId) override;
645 void disposeFrameBufferObject(int32_t frameBufferId) override;
646 vector<int32_t> createBufferObjects(int32_t bufferCount, bool useGPUMemory, bool shared) override;
647 void uploadBufferObject(int contextIdx, int32_t bufferObjectId, int32_t size, FloatBuffer* data) override;
648 void uploadBufferObject(int contextIdx, int32_t bufferObjectId, int32_t size, ShortBuffer* data) override;
649 void uploadBufferObject(int contextIdx, int32_t bufferObjectId, int32_t size, IntBuffer* data) override;
650 void uploadIndicesBufferObject(int contextIdx, int32_t bufferObjectId, int32_t size, ShortBuffer* data) override;
651 void uploadIndicesBufferObject(int contextIdx, int32_t bufferObjectId, int32_t size, IntBuffer* data) override;
652 void bindIndicesBufferObject(int contextIdx, int32_t bufferObjectId) override;
653 void bindTextureCoordinatesBufferObject(int contextIdx, int32_t bufferObjectId) override;
654 void bindVerticesBufferObject(int contextIdx, int32_t bufferObjectId) override;
655 void bindNormalsBufferObject(int contextIdx, int32_t bufferObjectId) override;
656 void bindColorsBufferObject(int contextIdx, int32_t bufferObjectId) override;
657 void bindTangentsBufferObject(int contextIdx, int32_t bufferObjectId) override;
658 void bindBitangentsBufferObject(int contextIdx, int32_t bufferObjectId) override;
659 void bindModelMatricesBufferObject(int contextIdx, int32_t bufferObjectId) override;
660 void bindEffectColorMulsBufferObject(int contextIdx, int32_t bufferObjectId, int32_t divisor) override;
661 void bindEffectColorAddsBufferObject(int contextIdx, int32_t bufferObjectIdd, int32_t divisor) override;
662 void bindOriginsBufferObject(int contextIdx, int32_t bufferObjectId) override;
663 void bindTextureSpriteIndicesBufferObject(int contextIdx, int32_t bufferObjectId) override;
664 void bindPointSizesBufferObject(int contextIdx, int32_t bufferObjectId) override;
665 void bindSpriteSheetDimensionBufferObject(int contextIdx, int32_t bufferObjectId) override;
666 void drawInstancedIndexedTrianglesFromBufferObjects(int contextIdx, int32_t triangles, int32_t trianglesOffset, int32_t instances) override;
667 void drawIndexedTrianglesFromBufferObjects(int contextIdx, int32_t triangles, int32_t trianglesOffset) override;
668 void drawInstancedTrianglesFromBufferObjects(int contextIdx, int32_t triangles, int32_t trianglesOffset, int32_t instances) override;
669 void drawTrianglesFromBufferObjects(int contextIdx, int32_t triangles, int32_t trianglesOffset) override;
670 void drawPointsFromBufferObjects(int contextIdx, int32_t points, int32_t pointsOffset) override;
671 void setLineWidth(float lineWidth) override;
672 void drawLinesFromBufferObjects(int contextIdx, int32_t points, int32_t pointsOffset) override;
673 void unbindBufferObjects(int contextIdx) override;
674 void disposeBufferObjects(vector<int32_t>& bufferObjectIds) override;
675 float readPixelDepth(int32_t x, int32_t y) override;
676 ByteBuffer* readPixels(int32_t x, int32_t y, int32_t width, int32_t height) override;
677 void initGuiMode() override;
678 void doneGuiMode() override;
679
680 // overridden methods for skinning on GPU via compute shader
681 void dispatchCompute(int contextIdx, int32_t numNodesX, int32_t numNodesY, int32_t numNodesZ) override;
682 void memoryBarrier() override;
683 void uploadSkinningBufferObject(int contextIdx, int32_t bufferObjectId, int32_t size, FloatBuffer* data) override;
684 void uploadSkinningBufferObject(int contextIdx, int32_t bufferObjectId, int32_t size, IntBuffer* data) override;
685 void bindSkinningVerticesBufferObject(int contextIdx, int32_t bufferObjectId) override;
686 void bindSkinningNormalsBufferObject(int contextIdx, int32_t bufferObjectId) override;
687 void bindSkinningVertexJointsBufferObject(int contextIdx, int32_t bufferObjectId) override;
688 void bindSkinningVertexJointIdxsBufferObject(int contextIdx, int32_t bufferObjectId) override;
689 void bindSkinningVertexJointWeightsBufferObject(int contextIdx, int32_t bufferObjectId) override;
690 void bindSkinningVerticesResultBufferObject(int contextIdx, int32_t bufferObjectId) override;
691 void bindSkinningNormalsResultBufferObject(int contextIdx, int32_t bufferObjectId) override;
692 void bindSkinningMatricesBufferObject(int contextIdx, int32_t bufferObjectId) override;
693
694 //
695 int32_t getTextureUnit(int contextIdx) override;
696 void setTextureUnit(int contextIdx, int32_t textureUnit) override;
697 const Renderer_Statistics getStatistics() override;
698
699 //
700 void setVSync(bool vSync) override;
701
702};
Engine main class.
Definition: Engine.h:122
TDME2 engine entity shader parameters.
Frame buffer class.
Definition: FrameBuffer.h:21
void setClearColor(float red, float green, float blue, float alpha) override
Set up clear color.
void prepareTextureImage(int contextIdx, struct texture_type *textureObject, VkImageTiling tiling, VkImageUsageFlags usage, VkFlags requiredFlags, Texture *texture, const array< ThsvsAccessType, 2 > &nextAccesses, ThsvsImageLayout imageLayout, bool disableMipMaps=true, uint32_t baseLevel=0, uint32_t levelCount=1)
Definition: VKRenderer.cpp:674
void enableDepthBufferWriting() override
Enable depth buffer writing.
void bindSpriteSheetDimensionBufferObject(int contextIdx, int32_t bufferObjectId) override
Bind sprite sheet dimension buffer object.
void bindTexture(int contextIdx, int32_t textureId) override
Binds a texture with given id or unbinds when using ID_NONE.
void clear(int32_t mask) override
Clear render buffer with given mask.
void createSkinningComputingProgram(program_type *program)
void bindTangentsBufferObject(int contextIdx, int32_t bufferObjectId) override
Bind tangents buffer object.
void disposeBufferObjects(vector< int32_t > &bufferObjectIds) override
Disposes a frame buffer object.
int32_t getTextureUnit(int contextIdx) override
Get texture unit.
void setProgramUniformFloatMatrix3x3(int contextIdx, int32_t uniformId, const array< float, 9 > &data) override
Set up a float matrix 3x3 uniform value.
VkPhysicalDeviceProperties gpuProperties
Definition: VKRenderer.h:384
void doneGuiMode() override
Set up renderer for 3d rendering.
void setColorMask(bool red, bool green, bool blue, bool alpha) override
Set up GL rendering colormask.
void bindTextureCoordinatesBufferObject(int contextIdx, int32_t bufferObjectId) override
Bind texture coordinates buffer object.
void submitDrawCommandBuffers(int commandBufferCount, VkCommandBuffer *commandBuffers, VkFence &fence)
Definition: VKRenderer.cpp:384
void setImageLayout2(int contextIdx, texture_type *textureObject, const array< ThsvsAccessType, 2 > &accessTypes, const array< ThsvsAccessType, 2 > &nextAccessTypes, ThsvsImageLayout layout, ThsvsImageLayout nextLayout, bool discardContent, uint32_t baseMipLevel, uint32_t levelCount, uint32_t baseArrayLayer, uint32_t layerCount, bool updateTextureObject)
Definition: VKRenderer.cpp:576
void bindSkinningVertexJointWeightsBufferObject(int contextIdx, int32_t bufferObjectId) override
Bind skinning vertex joint weights buffer object.
vector< delete_buffer_type > deleteBuffers
Definition: VKRenderer.h:468
void attachShaderToProgram(int32_t programId, int32_t shaderId) override
Attaches a shader to a program.
void setupObjectsRenderingPipeline(int contextIdx, program_type *program)
void dispatchCompute(int contextIdx, int32_t numNodesX, int32_t numNodesY, int32_t numNodesZ) override
Dispatch compute.
void setFrontFace(int contextIdx, int32_t frontFace) override
Set up clock wise or counter clock wise faces as front face.
void setTextureUnit(int contextIdx, int32_t textureUnit) override
Sets up texture unit.
void drawLinesFromBufferObjects(int contextIdx, int32_t points, int32_t pointsOffset) override
Draw lines from buffer objects.
void createBuffer(VkDeviceSize size, VkBufferUsageFlags usage, VkMemoryPropertyFlags properties, VkBuffer &buffer, VmaAllocation &allocation, VmaAllocationInfo &allocationInfo)
void createLinesRenderingPipeline(int contextIdx, program_type *program)
void disableBlending() override
Disables blending.
PFN_vkDestroySwapchainKHR fpDestroySwapchainKHR
Definition: VKRenderer.h:395
void setProgramAttributeLocation(int32_t programId, int32_t location, const string &name) override
Bind attribute to a input location.
VkBool32 checkLayers(uint32_t checkCount, const char **checkNames, const vector< VkLayerProperties > &instanceLayers)
Definition: VKRenderer.cpp:181
void setViewPort(int32_t width, int32_t height) override
Set up viewport parameter.
PFN_vkAcquireNextImageKHR fpAcquireNextImageKHR
Definition: VKRenderer.h:397
void bindSkinningVerticesResultBufferObject(int contextIdx, int32_t bufferObjectId) override
Bind skinning vertices result buffer object.
void setProgramUniformFloat(int contextIdx, int32_t uniformId, float value) override
Set up a float uniform value.
const Renderer_Statistics getStatistics() override
void uploadCubeMapSingleTexture(int contextIdx, texture_type *cubemapTextureType, Texture *texture, uint32_t baseArrayLayer)
void initialize() override
Initialize renderer.
Definition: VKRenderer.cpp:922
void setVSync(bool vSync) override
Enable/Disable v-sync.
int32_t createGBufferColorTexture(int32_t width, int32_t height) override
Creates a geometry buffer color RGBA texture.
PFN_vkCreateSwapchainKHR fpCreateSwapchainKHR
Definition: VKRenderer.h:394
unordered_map< int32_t, shader_type * > shaders
Definition: VKRenderer.h:417
uint16_t createPipelineIndex(program_type *program, int contextIdx)
void setProgramUniformFloatVec3(int contextIdx, int32_t uniformId, const array< float, 3 > &data) override
Set up a float vec3 uniform value.
bool isBufferObjectsAvailable() override
Checks if buffer objects is available.
void disposeFrameBufferObject(int32_t frameBufferId) override
Disposes a frame buffer object.
void uploadBufferObject(int contextIdx, int32_t bufferObjectId, int32_t size, FloatBuffer *data) override
Uploads buffer data to buffer object.
void uploadBufferObjectInternal(int contextIdx, buffer_object_type *buffer, int32_t size, const uint8_t *data, VkBufferUsageFlagBits usage)
void setProgramUniformInternal(int contextIdx, int32_t uniformId, uint8_t *data, int32_t size)
void memoryBarrier() override
Memory barrier.
void createBufferTexture(int32_t textureId, int32_t width, int32_t height, int32_t cubeMapTextureId, int32_t cubeMapTextureIndex, VkFormat format)
void setupSkinningComputingPipeline(int contextIdx, program_type *program)
void setProgramUniformInteger(int contextIdx, int32_t uniformId, int32_t value) override
Set up a integer uniform value.
int32_t getProgramUniformLocation(int32_t programId, const string &name) override
Returns location of given uniform variable.
void disableDepthBufferWriting() override
Disable depth buffer writing.
void createRenderProgram(program_type *program)
void setImageLayout(int contextIdx, texture_type *textureObject, const array< ThsvsAccessType, 2 > &nextAccessTypes, ThsvsImageLayout nextLayout, bool discardContent, uint32_t baseMipLevel=0, uint32_t levelCount=1, bool submit=true)
Definition: VKRenderer.cpp:416
void bindSkinningVertexJointIdxsBufferObject(int contextIdx, int32_t bufferObjectId) override
Bind skinning vertex joint indices buffer object.
void applyImageLayoutChange(int contextIdx, const image_layout_change &imageLayoutChange, texture_type *textureObject, bool submit=true)
Definition: VKRenderer.cpp:519
void bindNormalsBufferObject(int contextIdx, int32_t bufferObjectId) override
Bind normals buffer object.
void drawPointsFromBufferObjects(int contextIdx, int32_t points, int32_t pointsOffset) override
Draw points from buffer objects.
void vmaMemCpy(VmaAllocation allocationDst, const uint8_t *src, uint32_t size, uint32_t offset=0)
void disposeTexture(int32_t textureId) override
Dispose a texture.
int32_t createColorBufferTexture(int32_t width, int32_t height, int32_t cubeMapTextureId, int32_t cubeMapTextureIndex) override
Creates a color buffer texture.
void disableCulling(int contextIdx) override
Disable culling.
VkBuffer getBindBufferObjectInternal(int32_t bufferObjectId, uint32_t &size)
PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR fpGetPhysicalDeviceSurfaceCapabilitiesKHR
Definition: VKRenderer.h:391
void bindEffectColorMulsBufferObject(int contextIdx, int32_t bufferObjectId, int32_t divisor) override
Bind effect color muls buffer object.
int32_t createCubeMapTexture(int contextIdx, int32_t width, int32_t height) override
Create cube map texture from frame buffers.
void bindCubeMapTexture(int contextIdx, int32_t textureId) override
Binds a cube map texture with given id or unbinds when using ID_NONE.
framebuffer_pipelines_type * framebufferPipelinesCache
Definition: VKRenderer.h:408
void setProgramUniformFloatVec4(int contextIdx, int32_t uniformId, const array< float, 4 > &data) override
Set up a float vec4 uniform value.
void setDepthFunction(int32_t depthFunction) override
Set up depth function.
void uploadCubeMapTexture(int contextIdx, Texture *textureLeft, Texture *textureRight, Texture *textureTop, Texture *textureBottom, Texture *textureFront, Texture *textureBack) override
Uploads cube map texture data to current bound texture.
void bindFrameBuffer(int32_t frameBufferId) override
Enables a framebuffer to be rendered.
int32_t loadShader(int32_t type, const string &pathName, const string &fileName, const string &definitions=string(), const string &functions=string()) override
Loads a shader.
vector< framebuffer_pipelines_type * > framebuffersPipelines
Definition: VKRenderer.h:409
void createDepthStencilStateCreateInfo(VkPipelineDepthStencilStateCreateInfo &depthStencilStateCreateInfo)
bool isDepthTextureAvailable() override
Checks if depth texture is available.
void resizeDepthBufferTexture(int32_t textureId, int32_t width, int32_t height) override
Resizes a depth texture.
void resizeGBufferGeometryTexture(int32_t textureId, int32_t width, int32_t height) override
Resizes a geometry buffer geometry texture.
void finishFrame() override
Finish frame.
bool isInstancedRenderingAvailable() override
Checks if instanced rendering is available.
void drawTrianglesFromBufferObjects(int contextIdx, int32_t triangles, int32_t trianglesOffset) override
Draw triangles from buffer objects.
void createDepthBufferTexture(int32_t textureId, int32_t width, int32_t height, int32_t cubeMapTextureId, int32_t cubeMapTextureIndex)
void setImageLayout3(int contextIdx, VkImage image, VkImageAspectFlags aspectMask, const array< ThsvsAccessType, 2 > &accessTypes, const array< ThsvsAccessType, 2 > &nextAccessTypes, ThsvsImageLayout layout, ThsvsImageLayout nextLayout)
Definition: VKRenderer.cpp:620
void initGuiMode() override
Set up renderer for GUI rendering.
framebuffer_pipelines_type * createFramebufferPipelines(uint64_t framebufferPipelinesId)
void applyImageLayoutChanges(int contextIdx, const array< image_layout_change, 8 > imageLayoutChanges, array< texture_type *, 8 > textureObjects, bool submit=true)
Definition: VKRenderer.cpp:539
void bindSkinningVertexJointsBufferObject(int contextIdx, int32_t bufferObjectId) override
Bind skinning vertex joints buffer object.
void setCullFace(int32_t cullFace) override
Sets up which face will be culled.
vector< int32_t > createBufferObjects(int32_t bufferCount, bool useGPUMemory, bool shared) override
Generate buffer objects for vertex data and such.
void enableBlending() override
Enables blending.
void setupPointsRenderingPipeline(int contextIdx, program_type *program)
void setupLinesRenderingPipeline(int contextIdx, program_type *program)
void createObjectsRenderingPipeline(int contextIdx, program_type *program)
void uploadIndicesBufferObject(int contextIdx, int32_t bufferObjectId, int32_t size, ShortBuffer *data) override
Uploads buffer data to buffer object.
void drawInstancedTrianglesFromBufferObjects(int contextIdx, int32_t triangles, int32_t trianglesOffset, VkBuffer indicesBuffer, int32_t instances)
bool linkProgram(int32_t programId) override
Links attached shaders to a program.
void setProgramUniformFloatMatrix4x4(int contextIdx, int32_t uniformId, const array< float, 16 > &data) override
Set up a float matrix 4x4 uniform value.
void enableCulling(int contextIdx) override
Enable culling.
vector< delete_image_type > deleteImages
Definition: VKRenderer.h:469
PFN_vkGetPhysicalDeviceSurfacePresentModesKHR fpGetPhysicalDeviceSurfacePresentModesKHR
Definition: VKRenderer.h:393
bool beginDrawCommandBuffer(int contextIdx, int bufferId=-1)
Definition: VKRenderer.cpp:267
array< buffer_object_type *, BUFFERS_MAX+1 > buffers
Definition: VKRenderer.h:418
void bindOriginsBufferObject(int contextIdx, int32_t bufferObjectId) override
Bind origins buffer object.
int32_t createProgram(int type) override
Creates a shader program.
void bindIndicesBufferObject(int contextIdx, int32_t bufferObjectId) override
Bind indices buffer object.
void initializeFrame() override
Pre Frame Initialization.
int32_t createGBufferGeometryTexture(int32_t width, int32_t height) override
Creates a geometry buffer geometry texture.
void uploadSkinningBufferObject(int contextIdx, int32_t bufferObjectId, int32_t size, FloatBuffer *data) override
Upload skinning buffer object.
void enableAdditionBlending() override
Enable blending with c = a + b.
framebuffer_pipelines_type * getFramebufferPipelines(uint64_t framebufferPipelinesId)
void bindVerticesBufferObject(int contextIdx, int32_t bufferObjectId) override
Bind vertices buffer object.
texture_type * getBindTextureInternal(int32_t textureId)
void createRasterizationStateCreateInfo(int contextIdx, VkPipelineRasterizationStateCreateInfo &rasterizationStateCreateInfo)
void drawInstancedIndexedTrianglesFromBufferObjects(int contextIdx, int32_t triangles, int32_t trianglesOffset, int32_t instances) override
Draw instanced indexed triangles from buffer objects.
PFN_vkGetSwapchainImagesKHR fpGetSwapchainImagesKHR
Definition: VKRenderer.h:396
void useProgram(int contextIdx, int32_t programId) override
Use shader program.
void bindColorsBufferObject(int contextIdx, int32_t bufferObjectId) override
Bind colors buffer object.
void bindPointSizesBufferObject(int contextIdx, int32_t bufferObjectId) override
Bind point sizes buffer object.
void bindSkinningVerticesBufferObject(int contextIdx, int32_t bufferObjectId) override
Bind skinning vertices buffer object.
void createColorBlendAttachmentState(VkPipelineColorBlendAttachmentState &blendAttachmentState)
void bindBitangentsBufferObject(int contextIdx, int32_t bufferObjectId) override
Bind bitangents buffer object.
void bindSkinningNormalsResultBufferObject(int contextIdx, int32_t bufferObjectId) override
Bind skinning normals result buffer object.
void setProgramUniformFloatMatrices4x4(int contextIdx, int32_t uniformId, int32_t count, FloatBuffer *data) override
Set up a float matrices 4x4 uniform values.
void resizeGBufferColorTexture(int32_t textureId, int32_t width, int32_t height) override
Resizes a geometry buffer color RGBA texture.
void bindSkinningMatricesBufferObject(int contextIdx, int32_t bufferObjectId) override
Bind skinning matrices result buffer object.
int32_t createGeometryBufferObject(int32_t depthBufferTextureId, int32_t geometryBufferTextureId1, int32_t geometryBufferTextureId2, int32_t geometryBufferTextureId3, int32_t colorBufferTextureId1, int32_t colorBufferTextureId2, int32_t colorBufferTextureId3, int32_t colorBufferTextureId4, int32_t colorBufferTextureId5) override
Creates a geometry frame buffer object.
vector< window_frambuffer_buffer_type > windowFramebufferBuffers
Definition: VKRenderer.h:402
void updateViewPort() override
Update viewport.
void createFramebufferObject(int32_t frameBufferId)
VkPipeline getPipelineInternal(int contextIdx, program_type *programm, uint64_t framebuffePipelineId, uint32_t pipelineIdx)
void bindModelMatricesBufferObject(int contextIdx, int32_t bufferObjectId) override
Bind model matrices buffer object.
void createPointsRenderingPipeline(int contextIdx, program_type *program)
void drawIndexedTrianglesFromBufferObjects(int contextIdx, int32_t triangles, int32_t trianglesOffset) override
Draw indexed triangles from buffer objects.
void disableDepthBufferTest() override
Disable depth buffer test.
void bindSkinningNormalsBufferObject(int contextIdx, int32_t bufferObjectId) override
Bind skinning normal buffer object.
void unbindBufferObjects(int contextIdx) override
Unbind buffer objects.
array< texture_type *, TEXTURES_MAX+1 > textures
Definition: VKRenderer.h:419
VkPhysicalDeviceMemoryProperties memoryProperties
Definition: VKRenderer.h:387
texture_type * getTextureInternal(int32_t textureId)
void bindEffectColorAddsBufferObject(int contextIdx, int32_t bufferObjectIdd, int32_t divisor) override
Bind effect color adds buffer object.
int32_t createTexture() override
Creates a texture.
VkQueueFamilyProperties * queueProperties
Definition: VKRenderer.h:386
float readPixelDepth(int32_t x, int32_t y) override
Reads a pixel depth.
void uploadTexture(int contextIdx, Texture *texture) override
Uploads texture data to current bound texture.
void getImageLayoutChange(image_layout_change &imageLayoutChange, texture_type *textureObject, const array< ThsvsAccessType, 2 > &prevAccessTypes, const array< ThsvsAccessType, 2 > &nextAccessTypes, ThsvsImageLayout prevLayout, ThsvsImageLayout nextLayout, bool discardContent, uint32_t baseMipLevel=0, uint32_t levelCount=1)
Definition: VKRenderer.cpp:468
VkCommandBuffer endDrawCommandBuffer(int contextIdx, int bufferId=-1, bool cycleBuffers=true)
Definition: VKRenderer.cpp:353
void setLineWidth(float lineWidth) override
Set line width.
ByteBuffer * readPixels(int32_t x, int32_t y, int32_t width, int32_t height) override
Read pixels.
void enableDepthBufferTest() override
Enable depth buffer test.
void resizeColorBufferTexture(int32_t textureId, int32_t width, int32_t height) override
Resize color buffer texture.
static constexpr int OBJECTS_VERTEX_BUFFER_COUNT
Definition: VKRenderer.h:99
void bindTextureSpriteIndicesBufferObject(int contextIdx, int32_t bufferObjectId) override
Bind texture and sprite indices buffer object.
void setProgramUniformFloatVec2(int contextIdx, int32_t uniformId, const array< float, 2 > &data) override
Set up a float vec2 uniform value.
PFN_vkGetPhysicalDeviceSurfaceFormatsKHR fpGetPhysicalDeviceSurfaceFormatsKHR
Definition: VKRenderer.h:392
buffer_object_type * getBufferObjectInternal(int32_t bufferObjectId)
PFN_vkGetPhysicalDeviceSurfaceSupportKHR fpGetPhysicalDeviceSurfaceSupportKHR
Definition: VKRenderer.h:390
vector< framebuffer_object_type * > framebuffers
Definition: VKRenderer.h:422
3x3 2D Matrix class
Definition: Matrix2D3x3.h:22
4x4 3D Matrix class
Definition: Matrix4x4.h:24
Mutex implementation.
Definition: Mutex.h:27
Implementation for read/write lock.
Definition: ReadWriteLock.h:21
Spin Lock implementation.
Definition: SpinLock.h:16
Byte buffer class.
Definition: ByteBuffer.h:24
Float buffer class.
Definition: FloatBuffer.h:18
Integer buffer class.
Definition: IntBuffer.h:14
Short buffer class.
Definition: ShortBuffer.h:14
array< VkDescriptorBufferInfo, TEXTUREUNITS_MAX+SHADERSSTAGES_MAX > descriptorBufferInfos
Definition: VKRenderer.h:340
array< bound_texture, TEXTUREUNITS_MAX > boundTextures
Definition: VKRenderer.h:364
array< command_buffer, DRAW_COMMANDBUFFER_MAX > commandBuffers
Definition: VKRenderer.h:337
array< VkDescriptorImageInfo, TEXTUREUNITS_MAX+SHADERSSTAGES_MAX > descriptorImageInfos
Definition: VKRenderer.h:342
array< VkWriteDescriptorSet, TEXTUREUNITS_MAX+SHADERSSTAGES_MAX > descriptorWriteSets
Definition: VKRenderer.h:341
array< VkDescriptorSet, DESC_MAX_UNCACHED > texturesDescriptorSetsUncached
Definition: VKRenderer.h:203
array< VkDescriptorSet, DESC_MAX_CACHED > descriptorSets2
Definition: VKRenderer.h:207
unordered_map< SAMPLER_HASH_TYPE, int > texturesDescriptorSetsCache
Definition: VKRenderer.h:212
array< command_buffer, DRAW_COMMANDBUFFER_MAX > commandBuffers
Definition: VKRenderer.h:216
unordered_map< int32_t, unordered_set< SAMPLER_HASH_TYPE > > texturesDescriptorSetsCacheTextureIds
Definition: VKRenderer.h:213
unordered_map< string, uniform_type * > uniforms
Definition: VKRenderer.h:170
array< array< ThsvsAccessType, 2 >, 6 > accessTypes
Definition: VKRenderer.h:253
array< uniform_buffer_type_buffer, COMMANDS_MAX_GRAPHICS *DRAW_COMMANDBUFFER_MAX *5 > buffers
Definition: VKRenderer.h:151