Skip to content

Commit 5b4fcac

Browse files
author
N3xoX1
committed
Video: add watermark to vulkan
1 parent 8f5df10 commit 5b4fcac

14 files changed

Lines changed: 5049 additions & 4556 deletions

src/host_shaders/host_shaders.vcxproj

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,20 @@
353353
<Command>call "$(SolutionDir)src\script\generate_spc_header.cmd" "$(OutDir)" "%(FullPath)"</Command>
354354
<Outputs>$(SolutionDir)src\yuzu_video_core\host_shaders\%(Filename)_vert_spv.h</Outputs>
355355
</CustomBuild>
356+
<CustomBuild Include="..\yuzu_video_core\host_shaders\watermark.vert">
357+
<FileType>Document</FileType>
358+
<Message>Compiling %(Filename)%(Extension)</Message>
359+
<Command>call "$(SolutionDir)src\script\generate_spc_header.cmd" "$(OutDir)" "%(FullPath)"</Command>
360+
<Outputs>$(SolutionDir)src\yuzu_video_core\host_shaders\%(Filename)_vert_spv.h</Outputs>
361+
</CustomBuild>
362+
<CustomBuild Include="..\yuzu_video_core\host_shaders\watermark.frag">
363+
<FileType>Document</FileType>
364+
<Outputs>$(SolutionDir)src\yuzu_video_core\host_shaders\%(Filename)_frag.h</Outputs>
365+
<Message>Compiling %(Filename)%(Extension)</Message>
366+
<Command>call "$(SolutionDir)src\script\generate_shader_spc_header.cmd" "$(OutDir)" "%(FullPath)"
367+
</Command>
368+
<Outputs>$(SolutionDir)src\yuzu_video_core\host_shaders\%(Filename)_frag.h;$(SolutionDir)src\yuzu_video_core\host_shaders\%(Filename)_frag_spv.h</Outputs>
369+
</CustomBuild>
356370
</ItemGroup>
357371
<ItemGroup>
358372
<CustomBuild Include="..\yuzu_video_core\host_shaders\opengl_smaa.glsl">

src/host_shaders/host_shaders.vcxproj.filters

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,4 +193,9 @@
193193
<UniqueIdentifier>{5da5dfe3-1ad8-4805-9f8d-6554c3c53fca}</UniqueIdentifier>
194194
</Filter>
195195
</ItemGroup>
196+
<ItemGroup>
197+
<None Include="..\yuzu_video_core\host_shaders\watermark.vert">
198+
<Filter>vert</Filter>
199+
</None>
200+
</ItemGroup>
196201
</Project>

src/nxemu-core/nxemu-core.vcxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<ItemDefinitionGroup>
2626
<ClCompile>
2727
<UseStandardPreprocessor>true</UseStandardPreprocessor>
28-
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)external\fmt\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
28+
<AdditionalIncludeDirectories>$(SolutionDir)external\fmt\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
2929
</ClCompile>
3030
<PreBuildEvent>
3131
<Command>"$(SolutionDir)src\script\update_version.cmd" "$(Configuration)" "$(Platform)" "$(SolutionDir)src\nxemu-core\version.h.in" "$(SolutionDir)src\nxemu-core\version.h"</Command>

src/nxemu-video/render_window.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ std::unique_ptr<Core::Frontend::GraphicsContext> RenderWindow::CreateSharedConte
132132

133133
bool RenderWindow::IsShown() const
134134
{
135-
return false;
135+
return true;
136136
}
137137

138138
void RenderWindow::LoadOpenGL()
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// SPDX-License-Identifier: GPL-2.0-or-later
2+
3+
#version 460 core
4+
5+
layout(location = 0) in vec2 tex_coord;
6+
layout(location = 0) out vec4 frag_color;
7+
8+
layout(set = 0, binding = 0) uniform sampler2D watermark_texture;
9+
10+
layout(push_constant) uniform PushConstants {
11+
vec4 alpha_data; // Use vec4 like yuzu does
12+
};
13+
14+
void main() {
15+
vec4 tex_color = texture(watermark_texture, tex_coord);
16+
frag_color = vec4(tex_color.rgb, tex_color.a * alpha_data.x);
17+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// SPDX-License-Identifier: GPL-2.0-or-later
2+
3+
#version 460 core
4+
5+
layout(location = 0) in vec2 in_position;
6+
layout(location = 1) in vec2 in_tex_coord;
7+
8+
layout(location = 0) out vec2 tex_coord;
9+
10+
void main() {
11+
gl_Position = vec4(in_position, 0.0, 1.0);
12+
tex_coord = in_tex_coord;
13+
}

src/yuzu_video_core/renderer_opengl/renderer_opengl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ void RendererOpenGL::InitializeWatermark()
182182
while (glGetError() != GL_NO_ERROR) {}
183183

184184
int channels;
185-
unsigned char * image_data = stbi_load_from_memory(watermark_png, sizeof(watermark_png), &watermark_width, &watermark_height, &channels, 4);
185+
unsigned char * image_data = stbi_load_from_memory(watermark_png, watermark_png_len, &watermark_width, &watermark_height, &channels, 4);
186186
if (!image_data)
187187
{
188188
LOG_ERROR(Render_OpenGL, "Failed to load watermark image: {}", stbi_failure_reason());

0 commit comments

Comments
 (0)