Started work on variable rate shading sample
This commit is contained in:
parent
dcdabb9b12
commit
9d0fd8ce5a
5 changed files with 471 additions and 0 deletions
58
examples/variablerateshading/variablerateshading.h
Normal file
58
examples/variablerateshading/variablerateshading.h
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* Vulkan Example - Variable rate shading
|
||||
*
|
||||
* Copyright (C) 2020 by Sascha Willems - www.saschawillems.de
|
||||
*
|
||||
* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
|
||||
*/
|
||||
|
||||
#include "vulkanexamplebase.h"
|
||||
#include "VulkanglTFModel.h"
|
||||
|
||||
#define ENABLE_VALIDATION false
|
||||
|
||||
class VulkanExample : public VulkanExampleBase
|
||||
{
|
||||
public:
|
||||
vkglTF::Model scene;
|
||||
|
||||
struct ShadingRateImage {
|
||||
VkImage image;
|
||||
VkDeviceMemory memory;
|
||||
VkImageView view;
|
||||
} shadingRateImage;
|
||||
|
||||
struct ShaderData {
|
||||
vks::Buffer buffer;
|
||||
struct Values {
|
||||
glm::mat4 projection;
|
||||
glm::mat4 view;
|
||||
glm::mat4 model = glm::mat4(1.0f);
|
||||
glm::vec4 lightPos = glm::vec4(0.0f, -2.5f, 0.0f, 1.0f);
|
||||
glm::vec4 viewPos;
|
||||
} values;
|
||||
} shaderData;
|
||||
|
||||
VkPipeline pipeline;
|
||||
VkPipelineLayout pipelineLayout;
|
||||
VkDescriptorSet descriptorSet;
|
||||
VkDescriptorSetLayout descriptorSetLayout;
|
||||
|
||||
VkPhysicalDeviceShadingRateImageFeaturesNV enabledPhysicalDeviceShadingRateImageFeaturesNV;
|
||||
PFN_vkCmdBindShadingRateImageNV vkCmdBindShadingRateImageNV;
|
||||
|
||||
VulkanExample();
|
||||
~VulkanExample();
|
||||
virtual void getEnabledFeatures();
|
||||
void buildCommandBuffers();
|
||||
void loadglTFFile(std::string filename);
|
||||
void loadAssets();
|
||||
void prepareShadingRateImage();
|
||||
void setupDescriptors();
|
||||
void preparePipelines();
|
||||
void prepareUniformBuffers();
|
||||
void updateUniformBuffers();
|
||||
void prepare();
|
||||
virtual void render();
|
||||
virtual void OnUpdateUIOverlay(vks::UIOverlay* overlay);
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue