Skip to content

Commit

Permalink
Merge pull request #21 from vsg-dev/StorageBuffer
Browse files Browse the repository at this point in the history
Storage buffer
  • Loading branch information
robertosfield authored Mar 30, 2024
2 parents dbd7a34 + df30648 commit 54587ae
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 152 deletions.
4 changes: 2 additions & 2 deletions data/shaders/brick.vert
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ layout(location = 2) out vec4 vertexColor;

layout(location = 5) out vec3 viewDir;

layout(set = VIEW_DESCRIPTOR_SET, binding = 1) uniform ViewportData
layout(set = VIEW_DESCRIPTOR_SET, binding = 1) buffer ViewportData
{
vec4 values[1];
vec4 values[];
} viewportData;

out gl_PerVertex{
Expand Down
4 changes: 2 additions & 2 deletions src/vsgPoints/BrickShaderSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ vsg::ref_ptr<vsg::ShaderSet> vsgPoints::createPointsFlatShadedShaderSet(vsg::ref
shaderSet->addDescriptorBinding("diffuseMap", "VSG_DIFFUSE_MAP", MATERIAL_DESCRIPTOR_SET, 0, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_FRAGMENT_BIT, vsg::ubvec4Array2D::create(1, 1, vsg::Data::Properties{VK_FORMAT_R8G8B8A8_UNORM}));
shaderSet->addDescriptorBinding("material", "", MATERIAL_DESCRIPTOR_SET, 10, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_FRAGMENT_BIT, vsg::PhongMaterialValue::create());

shaderSet->addDescriptorBinding("lightData", "", VIEW_DESCRIPTOR_SET, 0, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT, vsg::vec4Array::create(64));
shaderSet->addDescriptorBinding("viewportData", "", VIEW_DESCRIPTOR_SET, 1, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1, VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT, vsg::vec4Value::create(0,0, 1280, 1024));
shaderSet->addDescriptorBinding("lightData", "", VIEW_DESCRIPTOR_SET, 0, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT, vsg::vec4Array::create(64));
shaderSet->addDescriptorBinding("viewportData", "", VIEW_DESCRIPTOR_SET, 1, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT, vsg::vec4Value::create(0,0, 1280, 1024));
shaderSet->addDescriptorBinding("shadowMaps", "", VIEW_DESCRIPTOR_SET, 2, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1, VK_SHADER_STAGE_FRAGMENT_BIT, vsg::floatArray3D::create(1, 1, 1, vsg::Data::Properties{VK_FORMAT_R32_SFLOAT}));

shaderSet->addPushConstantRange("pc", "", VK_SHADER_STAGE_VERTEX_BIT, 0, 128);
Expand Down
112 changes: 0 additions & 112 deletions src/vsgPoints/shaders/brick_flat_frag.cpp

This file was deleted.

2 changes: 1 addition & 1 deletion src/vsgPoints/shaders/brick_flat_shaded_frag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <vsg/io/mem_stream.h>
static auto brick_flat_shaded_frag = []() {
static const char str[] =
R"(#vsga 1.1.0
R"(#vsga 1.1.2
Root id=1 vsg::ShaderStage
{
userObjects 0
Expand Down
2 changes: 1 addition & 1 deletion src/vsgPoints/shaders/brick_phong_frag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <vsg/io/mem_stream.h>
static auto brick_phong_frag = []() {
static const char str[] =
R"(#vsga 1.1.0
R"(#vsga 1.1.2
Root id=1 vsg::ShaderStage
{
userObjects 0
Expand Down
68 changes: 34 additions & 34 deletions src/vsgPoints/shaders/brick_vert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <vsg/io/mem_stream.h>
static auto brick_vert = []() {
static const char str[] =
R"(#vsga 1.1.0
R"(#vsga 1.1.2
Root id=1 vsg::ShaderStage
{
userObjects 0
Expand Down Expand Up @@ -42,9 +42,9 @@ layout(location = 2) out vec4 vertexColor;
layout(location = 5) out vec3 viewDir;
layout(set = VIEW_DESCRIPTOR_SET, binding = 1) uniform ViewportData
layout(set = VIEW_DESCRIPTOR_SET, binding = 1) buffer ViewportData
{
vec4 values[1];
vec4 values[];
} viewportData;
out gl_PerVertex{
Expand Down Expand Up @@ -76,7 +76,7 @@ void main()
}
"
code 750
code 749
119734787 65536 524299 106 0 131089 1 393227 1 1280527431 1685353262 808793134
0 196622 0 1 917519 0 4 1852399981 0 12 20 29
48 59 62 68 70 76 196611 2 450 589828 1096764487 1935622738
Expand All @@ -97,7 +97,7 @@ void main()
35 64 327752 33 1 7 16 196679 33 2 262215 48
30 0 262215 59 30 5 262215 62 30 1 262215 68
30 2 262215 70 30 2 262215 76 30 4 262215 89
6 16 327752 90 0 35 0 196679 90 2 262215 92
6 16 327752 90 0 35 0 196679 90 3 262215 92
34 0 262215 92 33 1 131091 2 196641 3 2 196630
6 32 262167 7 6 4 262176 8 7 7 262167 10
6 3 262176 11 1 10 262203 11 12 1 262187 6
Expand All @@ -111,35 +111,35 @@ void main()
70 1 262176 72 7 6 262167 74 6 2 262176 75
1 74 262203 75 76 1 262165 77 32 0 262187 77
78 1 262176 79 1 6 262187 77 82 2 262176 83
3 6 262172 89 7 78 196638 90 89 262176 91 2
90 262203 91 92 2 262176 93 2 7 262187 77 96
3 262187 77 99 0 327734 2 4 0 3 131320 5
262203 8 9 7 262203 8 19 7 262203 72 73 7
262203 8 88 7 262205 10 13 12 327761 6 15 13
0 327761 6 16 13 1 327761 6 17 13 2 458832
7 18 15 16 17 14 196670 9 18 262205 10 21
20 327761 6 23 21 0 327761 6 24 21 1 327761
6 25 21 2 458832 7 26 23 24 25 22 196670
19 26 327745 36 37 35 31 262205 32 38 37 327745
36 40 35 39 262205 32 41 40 327826 32 42 38
41 262205 7 43 9 327825 7 44 42 43 327745 45
46 29 31 196670 46 44 327745 36 49 35 39 262205
32 50 49 262205 7 51 9 327825 7 52 50 51
327761 6 53 52 0 327761 6 54 52 1 327761 6
55 52 2 327761 6 56 52 3 458832 7 57 53
54 55 56 524367 10 58 57 57 0 1 2 196670
48 58 262205 10 60 48 262271 10 61 60 196670 59
61 327745 36 63 35 39 262205 32 64 63 262205 7
65 19 327825 7 66 64 65 524367 10 67 66 66
0 1 2 196670 62 67 262205 7 71 70 196670 68
71 327745 79 80 76 78 262205 6 81 80 327745 83
84 48 82 262205 6 85 84 393228 6 86 1 4
85 458764 6 87 1 40 81 86 196670 73 87 393281
93 94 92 31 31 262205 7 95 94 196670 88 95
327745 72 97 88 96 262205 6 98 97 327745 79 100
76 99 262205 6 101 100 262205 6 102 73 327816 6
103 101 102 327813 6 104 98 103 327745 83 105 29
39 196670 105 104 65789 65592
3 6 196637 89 7 196638 90 89 262176 91 2 90
262203 91 92 2 262176 93 2 7 262187 77 96 3
262187 77 99 0 327734 2 4 0 3 131320 5 262203
8 9 7 262203 8 19 7 262203 72 73 7 262203
8 88 7 262205 10 13 12 327761 6 15 13 0
327761 6 16 13 1 327761 6 17 13 2 458832 7
18 15 16 17 14 196670 9 18 262205 10 21 20
327761 6 23 21 0 327761 6 24 21 1 327761 6
25 21 2 458832 7 26 23 24 25 22 196670 19
26 327745 36 37 35 31 262205 32 38 37 327745 36
40 35 39 262205 32 41 40 327826 32 42 38 41
262205 7 43 9 327825 7 44 42 43 327745 45 46
29 31 196670 46 44 327745 36 49 35 39 262205 32
50 49 262205 7 51 9 327825 7 52 50 51 327761
6 53 52 0 327761 6 54 52 1 327761 6 55
52 2 327761 6 56 52 3 458832 7 57 53 54
55 56 524367 10 58 57 57 0 1 2 196670 48
58 262205 10 60 48 262271 10 61 60 196670 59 61
327745 36 63 35 39 262205 32 64 63 262205 7 65
19 327825 7 66 64 65 524367 10 67 66 66 0
1 2 196670 62 67 262205 7 71 70 196670 68 71
327745 79 80 76 78 262205 6 81 80 327745 83 84
48 82 262205 6 85 84 393228 6 86 1 4 85
458764 6 87 1 40 81 86 196670 73 87 393281 93
94 92 31 31 262205 7 95 94 196670 88 95 327745
72 97 88 96 262205 6 98 97 327745 79 100 76
99 262205 6 101 100 262205 6 102 73 327816 6 103
101 102 327813 6 104 98 103 327745 83 105 29 39
196670 105 104 65789 65592
}
NumSpecializationConstants 0
}
Expand Down

0 comments on commit 54587ae

Please sign in to comment.