-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #369 from mahkoh/jorth/unconditional-push-constants
vulkan: use single push constant range per pipeline
- Loading branch information
Showing
11 changed files
with
71 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
layout(push_constant, std430) uniform Data { | ||
layout(offset = 0) vec2 pos[4]; | ||
layout(offset = 32) vec4 color; | ||
} data; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
layout(constant_id = 0) const bool src_has_alpha = false; | ||
layout(constant_id = 1) const bool has_alpha_multiplier = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
layout(push_constant, std430) uniform Data { | ||
layout(offset = 0) vec2 pos[4]; | ||
layout(offset = 32) vec2 tex_pos[4]; | ||
layout(offset = 64) float mul; | ||
} data; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,20 @@ | ||
#version 450 | ||
|
||
#include "frag_spec_const.glsl" | ||
#include "tex.common.glsl" | ||
|
||
#ifdef ALPHA_MULTIPLIER | ||
layout(push_constant, std430) uniform Data { | ||
layout(offset = 64) float mul; | ||
} data; | ||
#endif | ||
layout(set = 0, binding = 0) uniform sampler2D tex; | ||
layout(location = 0) in vec2 tex_pos; | ||
layout(location = 0) out vec4 out_color; | ||
|
||
void main() { | ||
#ifdef ALPHA_MULTIPLIER | ||
if (src_has_alpha) { | ||
out_color = textureLod(tex, tex_pos, 0) * data.mul; | ||
if (has_alpha_multiplier) { | ||
if (src_has_alpha) { | ||
out_color = textureLod(tex, tex_pos, 0) * data.mul; | ||
} else { | ||
out_color = vec4(textureLod(tex, tex_pos, 0).rgb * data.mul, data.mul); | ||
} | ||
} else { | ||
out_color = vec4(textureLod(tex, tex_pos, 0).rgb * data.mul, data.mul); | ||
out_color = textureLod(tex, tex_pos, 0); | ||
} | ||
#else // !ALPHA_MULTIPLIER | ||
out_color = textureLod(tex, tex_pos, 0); | ||
#endif | ||
} |
Oops, something went wrong.