mirror of
https://github.com/citra-emu/citra.git
synced 2024-11-21 18:50:06 +00:00
video_core: Remove pre-compilation of Vulkan host-shaders. (#7461)
This commit is contained in:
parent
e0d2c1308e
commit
f4768cd26c
17
.github/workflows/build.yml
vendored
17
.github/workflows/build.yml
vendored
@ -81,7 +81,7 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-${{ matrix.target }}-
|
${{ runner.os }}-${{ matrix.target }}-
|
||||||
- name: Install tools
|
- name: Install tools
|
||||||
run: brew install ccache glslang ninja
|
run: brew install ccache ninja
|
||||||
- name: Build
|
- name: Build
|
||||||
run: ./.ci/macos.sh
|
run: ./.ci/macos.sh
|
||||||
- name: Prepare outputs for caching
|
- name: Prepare outputs for caching
|
||||||
@ -153,13 +153,6 @@ jobs:
|
|||||||
- name: Install extra tools (MSVC)
|
- name: Install extra tools (MSVC)
|
||||||
run: choco install ccache ninja wget
|
run: choco install ccache ninja wget
|
||||||
if: ${{ matrix.target == 'msvc' }}
|
if: ${{ matrix.target == 'msvc' }}
|
||||||
- name: Set up Vulkan SDK (MSVC)
|
|
||||||
uses: humbletim/setup-vulkan-sdk@v1.2.0
|
|
||||||
if: ${{ matrix.target == 'msvc' }}
|
|
||||||
with:
|
|
||||||
vulkan-query-version: latest
|
|
||||||
vulkan-components: SPIRV-Tools, Glslang
|
|
||||||
vulkan-use-cache: true
|
|
||||||
- name: Set up MSYS2
|
- name: Set up MSYS2
|
||||||
uses: msys2/setup-msys2@v2
|
uses: msys2/setup-msys2@v2
|
||||||
if: ${{ matrix.target == 'msys2' }}
|
if: ${{ matrix.target == 'msys2' }}
|
||||||
@ -168,10 +161,8 @@ jobs:
|
|||||||
update: true
|
update: true
|
||||||
install: git make p7zip
|
install: git make p7zip
|
||||||
pacboy: >-
|
pacboy: >-
|
||||||
toolchain:p ccache:p cmake:p ninja:p glslang:p
|
toolchain:p ccache:p cmake:p ninja:p
|
||||||
qt6-base:p qt6-multimedia:p qt6-multimedia-wmf:p qt6-tools:p qt6-translations:p
|
qt6-base:p qt6-multimedia:p qt6-multimedia-wmf:p qt6-tools:p qt6-translations:p
|
||||||
- name: Test glslang
|
|
||||||
run: glslang --version || glslangValidator --version
|
|
||||||
- name: Disable line ending translation
|
- name: Disable line ending translation
|
||||||
run: git config --global core.autocrlf input
|
run: git config --global core.autocrlf input
|
||||||
- name: Build
|
- name: Build
|
||||||
@ -215,7 +206,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
sudo add-apt-repository -y ppa:theofficialgman/gpu-tools
|
sudo add-apt-repository -y ppa:theofficialgman/gpu-tools
|
||||||
sudo apt-get update -y
|
sudo apt-get update -y
|
||||||
sudo apt-get install ccache glslang-dev glslang-tools apksigner -y
|
sudo apt-get install ccache apksigner -y
|
||||||
- name: Build
|
- name: Build
|
||||||
run: JAVA_HOME=$JAVA_HOME_17_X64 ./.ci/android.sh
|
run: JAVA_HOME=$JAVA_HOME_17_X64 ./.ci/android.sh
|
||||||
env:
|
env:
|
||||||
@ -253,7 +244,7 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-ios-
|
${{ runner.os }}-ios-
|
||||||
- name: Install tools
|
- name: Install tools
|
||||||
run: brew install ccache glslang ninja
|
run: brew install ccache ninja
|
||||||
- name: Build
|
- name: Build
|
||||||
run: ./.ci/ios.sh
|
run: ./.ci/ios.sh
|
||||||
release:
|
release:
|
||||||
|
@ -26,17 +26,6 @@ set(SHADER_FILES
|
|||||||
vulkan_blit_depth_stencil.frag
|
vulkan_blit_depth_stencil.frag
|
||||||
)
|
)
|
||||||
|
|
||||||
find_program(GLSLANG "glslang")
|
|
||||||
if ("${GLSLANG}" STREQUAL "GLSLANG-NOTFOUND")
|
|
||||||
find_program(GLSLANG "glslangValidator")
|
|
||||||
if ("${GLSLANG}" STREQUAL "GLSLANG-NOTFOUND")
|
|
||||||
message(FATAL_ERROR "Required program `glslang` (or `glslangValidator`) not found.")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(MACROS "-Dgl_VertexID=gl_VertexIndex")
|
|
||||||
set(QUIET_FLAG "--quiet")
|
|
||||||
|
|
||||||
set(SHADER_INCLUDE ${CMAKE_CURRENT_BINARY_DIR}/include)
|
set(SHADER_INCLUDE ${CMAKE_CURRENT_BINARY_DIR}/include)
|
||||||
set(SHADER_DIR ${SHADER_INCLUDE}/video_core/host_shaders)
|
set(SHADER_DIR ${SHADER_INCLUDE}/video_core/host_shaders)
|
||||||
set(HOST_SHADERS_INCLUDE ${SHADER_INCLUDE} PARENT_SCOPE)
|
set(HOST_SHADERS_INCLUDE ${SHADER_INCLUDE} PARENT_SCOPE)
|
||||||
@ -44,28 +33,9 @@ set(HOST_SHADERS_INCLUDE ${SHADER_INCLUDE} PARENT_SCOPE)
|
|||||||
set(INPUT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/source_shader.h.in)
|
set(INPUT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/source_shader.h.in)
|
||||||
set(HEADER_GENERATOR ${CMAKE_CURRENT_SOURCE_DIR}/StringShaderHeader.cmake)
|
set(HEADER_GENERATOR ${CMAKE_CURRENT_SOURCE_DIR}/StringShaderHeader.cmake)
|
||||||
|
|
||||||
# Check if `--quiet` is available on host's glslang version
|
|
||||||
# glslang prints to STDERR iff an unrecognized flag is passed to it
|
|
||||||
execute_process(
|
|
||||||
COMMAND
|
|
||||||
${GLSLANG} ${QUIET_FLAG}
|
|
||||||
ERROR_VARIABLE
|
|
||||||
GLSLANG_ERROR
|
|
||||||
# STDOUT variable defined to silence unnecessary output during CMake configuration
|
|
||||||
OUTPUT_VARIABLE
|
|
||||||
GLSLANG_OUTPUT
|
|
||||||
)
|
|
||||||
|
|
||||||
if (NOT GLSLANG_ERROR STREQUAL "")
|
|
||||||
message(WARNING "Refusing to use unavailable flag `${QUIET_FLAG}` on `${GLSLANG}`")
|
|
||||||
set(QUIET_FLAG "")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
foreach(FILENAME IN ITEMS ${SHADER_FILES})
|
foreach(FILENAME IN ITEMS ${SHADER_FILES})
|
||||||
string(REPLACE "." "_" SHADER_NAME ${FILENAME})
|
string(REPLACE "." "_" SHADER_NAME ${FILENAME})
|
||||||
set(SOURCE_FILE ${CMAKE_CURRENT_SOURCE_DIR}/${FILENAME})
|
set(SOURCE_FILE ${CMAKE_CURRENT_SOURCE_DIR}/${FILENAME})
|
||||||
# Skip generating source headers on Vulkan exclusive files
|
|
||||||
if (NOT ${FILENAME} MATCHES "vulkan.*")
|
|
||||||
set(SOURCE_HEADER_FILE ${SHADER_DIR}/${SHADER_NAME}.h)
|
set(SOURCE_HEADER_FILE ${SHADER_DIR}/${SHADER_NAME}.h)
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT
|
OUTPUT
|
||||||
@ -79,22 +49,6 @@ foreach(FILENAME IN ITEMS ${SHADER_FILES})
|
|||||||
# HEADER_GENERATOR should be included here but msbuild seems to assume it's always modified
|
# HEADER_GENERATOR should be included here but msbuild seems to assume it's always modified
|
||||||
)
|
)
|
||||||
set(SHADER_HEADERS ${SHADER_HEADERS} ${SOURCE_HEADER_FILE})
|
set(SHADER_HEADERS ${SHADER_HEADERS} ${SOURCE_HEADER_FILE})
|
||||||
endif()
|
|
||||||
# Skip compiling to SPIR-V OpenGL exclusive files
|
|
||||||
if (NOT ${FILENAME} MATCHES "opengl.*")
|
|
||||||
get_filename_component(FILE_NAME ${SHADER_NAME} NAME)
|
|
||||||
string(TOUPPER ${FILE_NAME}_SPV SPIRV_VARIABLE_NAME)
|
|
||||||
set(SPIRV_HEADER_FILE ${SHADER_DIR}/${SHADER_NAME}_spv.h)
|
|
||||||
add_custom_command(
|
|
||||||
OUTPUT
|
|
||||||
${SPIRV_HEADER_FILE}
|
|
||||||
COMMAND
|
|
||||||
${GLSLANG} --target-env vulkan1.1 --glsl-version 450 ${QUIET_FLAG} ${MACROS} --variable-name ${SPIRV_VARIABLE_NAME} -o ${SPIRV_HEADER_FILE} ${SOURCE_FILE}
|
|
||||||
MAIN_DEPENDENCY
|
|
||||||
${SOURCE_FILE}
|
|
||||||
)
|
|
||||||
set(SHADER_HEADERS ${SHADER_HEADERS} ${SPIRV_HEADER_FILE})
|
|
||||||
endif()
|
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
set(SHADER_SOURCES ${SHADER_FILES})
|
set(SHADER_SOURCES ${SHADER_FILES})
|
||||||
|
@ -8,6 +8,10 @@ layout(location = 0) out vec2 dst_coord;
|
|||||||
|
|
||||||
layout(location = 0) uniform mediump ivec2 dst_size;
|
layout(location = 0) uniform mediump ivec2 dst_size;
|
||||||
|
|
||||||
|
#ifdef VULKAN
|
||||||
|
#define gl_VertexID gl_VertexIndex
|
||||||
|
#endif
|
||||||
|
|
||||||
const vec2 vertices[4] =
|
const vec2 vertices[4] =
|
||||||
vec2[4](vec2(-1.0, -1.0), vec2(1.0, -1.0), vec2(-1.0, 1.0), vec2(1.0, 1.0));
|
vec2[4](vec2(-1.0, -1.0), vec2(1.0, -1.0), vec2(-1.0, 1.0), vec2(1.0, 1.0));
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ out gl_PerVertex {
|
|||||||
layout(location = 0) out vec2 texcoord;
|
layout(location = 0) out vec2 texcoord;
|
||||||
|
|
||||||
#ifdef VULKAN
|
#ifdef VULKAN
|
||||||
|
#define gl_VertexID gl_VertexIndex
|
||||||
#define BEGIN_PUSH_CONSTANTS layout(push_constant) uniform PushConstants {
|
#define BEGIN_PUSH_CONSTANTS layout(push_constant) uniform PushConstants {
|
||||||
#define END_PUSH_CONSTANTS };
|
#define END_PUSH_CONSTANTS };
|
||||||
#define UNIFORM(n)
|
#define UNIFORM(n)
|
||||||
|
@ -5,6 +5,10 @@
|
|||||||
//? #version 430 core
|
//? #version 430 core
|
||||||
layout(location = 0) out vec2 tex_coord;
|
layout(location = 0) out vec2 tex_coord;
|
||||||
|
|
||||||
|
#ifdef VULKAN
|
||||||
|
#define gl_VertexID gl_VertexIndex
|
||||||
|
#endif
|
||||||
|
|
||||||
const vec2 vertices[4] =
|
const vec2 vertices[4] =
|
||||||
vec2[4](vec2(-1.0, -1.0), vec2(1.0, -1.0), vec2(-1.0, 1.0), vec2(1.0, 1.0));
|
vec2[4](vec2(-1.0, -1.0), vec2(1.0, -1.0), vec2(-1.0, 1.0), vec2(1.0, 1.0));
|
||||||
|
|
||||||
|
@ -15,10 +15,10 @@
|
|||||||
#include "video_core/renderer_vulkan/vk_memory_util.h"
|
#include "video_core/renderer_vulkan/vk_memory_util.h"
|
||||||
#include "video_core/renderer_vulkan/vk_shader_util.h"
|
#include "video_core/renderer_vulkan/vk_shader_util.h"
|
||||||
|
|
||||||
#include "video_core/host_shaders/vulkan_present_anaglyph_frag_spv.h"
|
#include "video_core/host_shaders/vulkan_present_anaglyph_frag.h"
|
||||||
#include "video_core/host_shaders/vulkan_present_frag_spv.h"
|
#include "video_core/host_shaders/vulkan_present_frag.h"
|
||||||
#include "video_core/host_shaders/vulkan_present_interlaced_frag_spv.h"
|
#include "video_core/host_shaders/vulkan_present_interlaced_frag.h"
|
||||||
#include "video_core/host_shaders/vulkan_present_vert_spv.h"
|
#include "video_core/host_shaders/vulkan_present_vert.h"
|
||||||
|
|
||||||
#include <vk_mem_alloc.h>
|
#include <vk_mem_alloc.h>
|
||||||
|
|
||||||
@ -225,10 +225,14 @@ void RendererVulkan::LoadFBToScreenInfo(const Pica::FramebufferConfig& framebuff
|
|||||||
|
|
||||||
void RendererVulkan::CompileShaders() {
|
void RendererVulkan::CompileShaders() {
|
||||||
vk::Device device = instance.GetDevice();
|
vk::Device device = instance.GetDevice();
|
||||||
present_vertex_shader = CompileSPV(VULKAN_PRESENT_VERT_SPV, device);
|
present_vertex_shader =
|
||||||
present_shaders[0] = CompileSPV(VULKAN_PRESENT_FRAG_SPV, device);
|
Compile(HostShaders::VULKAN_PRESENT_VERT, vk::ShaderStageFlagBits::eVertex, device);
|
||||||
present_shaders[1] = CompileSPV(VULKAN_PRESENT_ANAGLYPH_FRAG_SPV, device);
|
present_shaders[0] =
|
||||||
present_shaders[2] = CompileSPV(VULKAN_PRESENT_INTERLACED_FRAG_SPV, device);
|
Compile(HostShaders::VULKAN_PRESENT_FRAG, vk::ShaderStageFlagBits::eFragment, device);
|
||||||
|
present_shaders[1] = Compile(HostShaders::VULKAN_PRESENT_ANAGLYPH_FRAG,
|
||||||
|
vk::ShaderStageFlagBits::eFragment, device);
|
||||||
|
present_shaders[2] = Compile(HostShaders::VULKAN_PRESENT_INTERLACED_FRAG,
|
||||||
|
vk::ShaderStageFlagBits::eFragment, device);
|
||||||
|
|
||||||
auto properties = instance.GetPhysicalDevice().getProperties();
|
auto properties = instance.GetPhysicalDevice().getProperties();
|
||||||
for (std::size_t i = 0; i < present_samplers.size(); i++) {
|
for (std::size_t i = 0; i < present_samplers.size(); i++) {
|
||||||
|
@ -10,10 +10,10 @@
|
|||||||
#include "video_core/renderer_vulkan/vk_shader_util.h"
|
#include "video_core/renderer_vulkan/vk_shader_util.h"
|
||||||
#include "video_core/renderer_vulkan/vk_texture_runtime.h"
|
#include "video_core/renderer_vulkan/vk_texture_runtime.h"
|
||||||
|
|
||||||
#include "video_core/host_shaders/format_reinterpreter/vulkan_d24s8_to_rgba8_comp_spv.h"
|
#include "video_core/host_shaders/format_reinterpreter/vulkan_d24s8_to_rgba8_comp.h"
|
||||||
#include "video_core/host_shaders/full_screen_triangle_vert_spv.h"
|
#include "video_core/host_shaders/full_screen_triangle_vert.h"
|
||||||
#include "video_core/host_shaders/vulkan_blit_depth_stencil_frag_spv.h"
|
#include "video_core/host_shaders/vulkan_blit_depth_stencil_frag.h"
|
||||||
#include "video_core/host_shaders/vulkan_depth_to_buffer_comp_spv.h"
|
#include "video_core/host_shaders/vulkan_depth_to_buffer_comp.h"
|
||||||
|
|
||||||
namespace Vulkan {
|
namespace Vulkan {
|
||||||
|
|
||||||
@ -189,10 +189,14 @@ BlitHelper::BlitHelper(const Instance& instance_, Scheduler& scheduler_, Descrip
|
|||||||
PipelineLayoutCreateInfo(&compute_buffer_provider.Layout(), true))},
|
PipelineLayoutCreateInfo(&compute_buffer_provider.Layout(), true))},
|
||||||
two_textures_pipeline_layout{
|
two_textures_pipeline_layout{
|
||||||
device.createPipelineLayout(PipelineLayoutCreateInfo(&two_textures_provider.Layout()))},
|
device.createPipelineLayout(PipelineLayoutCreateInfo(&two_textures_provider.Layout()))},
|
||||||
full_screen_vert{CompileSPV(FULL_SCREEN_TRIANGLE_VERT_SPV, device)},
|
full_screen_vert{Compile(HostShaders::FULL_SCREEN_TRIANGLE_VERT,
|
||||||
d24s8_to_rgba8_comp{CompileSPV(VULKAN_D24S8_TO_RGBA8_COMP_SPV, device)},
|
vk::ShaderStageFlagBits::eVertex, device)},
|
||||||
depth_to_buffer_comp{CompileSPV(VULKAN_DEPTH_TO_BUFFER_COMP_SPV, device)},
|
d24s8_to_rgba8_comp{Compile(HostShaders::VULKAN_D24S8_TO_RGBA8_COMP,
|
||||||
blit_depth_stencil_frag{CompileSPV(VULKAN_BLIT_DEPTH_STENCIL_FRAG_SPV, device)},
|
vk::ShaderStageFlagBits::eCompute, device)},
|
||||||
|
depth_to_buffer_comp{Compile(HostShaders::VULKAN_DEPTH_TO_BUFFER_COMP,
|
||||||
|
vk::ShaderStageFlagBits::eCompute, device)},
|
||||||
|
blit_depth_stencil_frag{Compile(HostShaders::VULKAN_BLIT_DEPTH_STENCIL_FRAG,
|
||||||
|
vk::ShaderStageFlagBits::eFragment, device)},
|
||||||
d24s8_to_rgba8_pipeline{MakeComputePipeline(d24s8_to_rgba8_comp, compute_pipeline_layout)},
|
d24s8_to_rgba8_pipeline{MakeComputePipeline(d24s8_to_rgba8_comp, compute_pipeline_layout)},
|
||||||
depth_to_buffer_pipeline{
|
depth_to_buffer_pipeline{
|
||||||
MakeComputePipeline(depth_to_buffer_comp, compute_buffer_pipeline_layout)},
|
MakeComputePipeline(depth_to_buffer_comp, compute_buffer_pipeline_layout)},
|
||||||
|
Loading…
Reference in New Issue
Block a user