mirror of
https://github.com/Vita3K/Vita3K-Android.git
synced 2024-11-27 07:20:51 +00:00
external: Update submodule (#2331)
- external: Link LibAtrac9 statically on MSVC
This commit is contained in:
parent
1df7f42d5c
commit
5825c463ca
2
.gitmodules
vendored
2
.gitmodules
vendored
@ -86,7 +86,7 @@
|
||||
url = https://github.com/fmtlib/fmt.git
|
||||
[submodule "external/LibAtrac9"]
|
||||
path = external/LibAtrac9
|
||||
url = https://github.com/Thealexbarney/LibAtrac9/
|
||||
url = https://github.com/Vita3K/LibAtrac9.git
|
||||
[submodule "external/tracy"]
|
||||
path = external/tracy
|
||||
url = https://github.com/wolfpld/tracy.git
|
||||
|
14
external/CMakeLists.txt
vendored
14
external/CMakeLists.txt
vendored
@ -44,8 +44,6 @@ option(CAPSTONE_BUILD_CSTOOL "Build cstool" OFF)
|
||||
option(CAPSTONE_ARCHITECTURE_DEFAULT "Whether architectures are enabled by default" OFF)
|
||||
option(CAPSTONE_ARM_SUPPORT "ARM support" ON)
|
||||
add_subdirectory(capstone EXCLUDE_FROM_ALL)
|
||||
set_property(TARGET capstone-static PROPERTY FOLDER externals)
|
||||
set(capstone_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/capstone/include" PARENT_SCOPE)
|
||||
|
||||
add_library(crypto-algorithms STATIC crypto-algorithms/sha256.c crypto-algorithms/sha256.h)
|
||||
target_include_directories(crypto-algorithms PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/crypto-algorithms")
|
||||
@ -273,7 +271,6 @@ option(SPIRV_CROSS_SKIP_INSTALL "Skips installation targets." ON)
|
||||
add_subdirectory(SPIRV-Cross)
|
||||
set_property(TARGET spirv-cross-core PROPERTY FOLDER externals)
|
||||
set_property(TARGET spirv-cross-glsl PROPERTY FOLDER externals)
|
||||
set_property(TARGET glslang-build-info PROPERTY FOLDER glslang)
|
||||
|
||||
add_library(dlmalloc STATIC "${CMAKE_CURRENT_SOURCE_DIR}/dlmalloc/dlmalloc.cc")
|
||||
target_include_directories(dlmalloc PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/dlmalloc")
|
||||
@ -346,16 +343,7 @@ file(GLOB LIBATRAC9_SOURCES
|
||||
LibAtrac9/C/src/*.c
|
||||
LibAtrac9/C/src/*.h
|
||||
)
|
||||
|
||||
# libatrac9 has MSVC-specific behavior that causes linking errors if the library
|
||||
# is set to be compiled as a static object
|
||||
if(MSVC)
|
||||
add_library(libatrac9 SHARED ${LIBATRAC9_SOURCES}) # Compile as shared object
|
||||
set_target_properties(libatrac9 PROPERTIES # Bundle .DLL with the Vita3K executable
|
||||
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
|
||||
else()
|
||||
add_library(libatrac9 STATIC ${LIBATRAC9_SOURCES}) # Compile as static object
|
||||
endif()
|
||||
add_library(libatrac9 STATIC ${LIBATRAC9_SOURCES})
|
||||
|
||||
target_include_directories(libatrac9 PUBLIC LibAtrac9/C/src)
|
||||
set_property(TARGET libatrac9 PROPERTY FOLDER externals)
|
||||
|
2
external/LibAtrac9
vendored
2
external/LibAtrac9
vendored
@ -1 +1 @@
|
||||
Subproject commit 6a9e00f6c7abd74d037fd210b6670d3cdb313049
|
||||
Subproject commit 82767fe38823c32536726ea798f392b0b49e66b9
|
2
external/SPIRV-Cross
vendored
2
external/SPIRV-Cross
vendored
@ -1 +1 @@
|
||||
Subproject commit e9cc6403341baf0edd430a4027b074d0a06b782f
|
||||
Subproject commit 4e2fdb25671c742a9fbe93a6034eb1542244c7e1
|
2
external/capstone
vendored
2
external/capstone
vendored
@ -1 +1 @@
|
||||
Subproject commit 1d230532840a37ac032c6ab80128238fc930c6c1
|
||||
Subproject commit 6eb1db9c04113ac0a05f2dfd228704c84775530f
|
2
external/fmt
vendored
2
external/fmt
vendored
@ -1 +1 @@
|
||||
Subproject commit b6f4ceaed0a0a24ccf575fab6c56dd50ccf6f1a9
|
||||
Subproject commit a33701196adfad74917046096bf5a2aa0ab0bb50
|
2
external/glslang
vendored
2
external/glslang
vendored
@ -1 +1 @@
|
||||
Subproject commit 740ae9f60b009196662bad811924788cee56133a
|
||||
Subproject commit ca8d07d0bc1c6390b83915700439fa7719de6a2a
|
2
external/spdlog
vendored
2
external/spdlog
vendored
@ -1 +1 @@
|
||||
Subproject commit eb3220622e73a4889eee355ffa37972b3cac3df5
|
||||
Subproject commit da14258533cb951ce85087ceb45556e0b8253660
|
2
external/xxHash
vendored
2
external/xxHash
vendored
@ -1 +1 @@
|
||||
Subproject commit 35d394864ef89241d4a77d7c2bd8c659df3f5cd4
|
||||
Subproject commit 6dba9abfaae75a4b70a5c53d7e5eb3dd554973d1
|
@ -24,5 +24,4 @@ source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${SOURCE_LIST})
|
||||
|
||||
target_include_directories(cpu PUBLIC include)
|
||||
target_link_libraries(cpu PUBLIC mem util)
|
||||
target_include_directories(cpu PRIVATE ${capstone_INCLUDE_DIRS})
|
||||
target_link_libraries(cpu PRIVATE dynarmic unicorn capstone-static)
|
||||
target_link_libraries(cpu PRIVATE dynarmic unicorn capstone)
|
||||
|
@ -88,8 +88,8 @@ void draw(GLState &renderer, GLContext &context, const FeatureState &features, S
|
||||
const std::string hash_text_v = hex_string(context.record.vertex_program.get(mem)->renderer_data->hash);
|
||||
|
||||
LOG_DEBUG("\nVertex : {}\nFragment: {}", hash_text_v, hash_text_f);
|
||||
LOG_DEBUG("Vertex default uniform buffer: {:a}\n", spdlog::to_hex(context.ubo_data[0].begin(), context.ubo_data[0].end(), 16));
|
||||
LOG_DEBUG("Fragment default uniform buffer: {:a}\n", spdlog::to_hex(context.ubo_data[SCE_GXM_REAL_MAX_UNIFORM_BUFFER].begin(), context.ubo_data[SCE_GXM_REAL_MAX_UNIFORM_BUFFER].end(), 16));
|
||||
LOG_DEBUG("Vertex default uniform buffer: {}\n", spdlog::to_hex(context.ubo_data[0].begin(), context.ubo_data[0].end(), 16));
|
||||
LOG_DEBUG("Fragment default uniform buffer: {}\n", spdlog::to_hex(context.ubo_data[SCE_GXM_REAL_MAX_UNIFORM_BUFFER].begin(), context.ubo_data[SCE_GXM_REAL_MAX_UNIFORM_BUFFER].end(), 16));
|
||||
}
|
||||
|
||||
if (!program_id) {
|
||||
|
@ -226,7 +226,7 @@ bool create(SDL_Window *window, std::unique_ptr<State> &state, const char *base_
|
||||
const std::string version = reinterpret_cast<const GLchar *>(glGetString(GL_SHADING_LANGUAGE_VERSION));
|
||||
|
||||
LOG_INFO("GPU = {}", gpu_name);
|
||||
LOG_INFO("GL_VERSION = {}", glGetString(GL_VERSION));
|
||||
LOG_INFO("GL_VERSION = {}", reinterpret_cast<const char*>(glGetString(GL_VERSION)));
|
||||
LOG_INFO("GL_SHADING_LANGUAGE_VERSION = {}", version);
|
||||
|
||||
#ifndef NDEBUG
|
||||
|
@ -364,8 +364,8 @@ void draw(VKContext &context, SceGxmPrimitiveType type, SceGxmIndexFormat format
|
||||
const std::string hash_text_v = hex_string(context.record.vertex_program.get(mem)->renderer_data->hash);
|
||||
|
||||
LOG_DEBUG("\nVertex : {}\nFragment: {}", hash_text_v, hash_text_f);
|
||||
LOG_DEBUG("Vertex default uniform buffer: {:a}\n", spdlog::to_hex(context.ubo_data[0].begin(), context.ubo_data[0].end(), 16));
|
||||
LOG_DEBUG("Fragment default uniform buffer: {:a}\n", spdlog::to_hex(context.ubo_data[SCE_GXM_REAL_MAX_UNIFORM_BUFFER].begin(), context.ubo_data[SCE_GXM_REAL_MAX_UNIFORM_BUFFER].end(), 16));
|
||||
LOG_DEBUG("Vertex default uniform buffer: {}\n", spdlog::to_hex(context.ubo_data[0].begin(), context.ubo_data[0].end(), 16));
|
||||
LOG_DEBUG("Fragment default uniform buffer: {}\n", spdlog::to_hex(context.ubo_data[SCE_GXM_REAL_MAX_UNIFORM_BUFFER].begin(), context.ubo_data[SCE_GXM_REAL_MAX_UNIFORM_BUFFER].end(), 16));
|
||||
}
|
||||
|
||||
shader::RenderVertUniformBlock &vert_ublock = context.current_vert_render_info;
|
||||
|
@ -57,6 +57,8 @@ spv::Id convert_to_int(spv::Builder &b, spv::Id opr, DataType type, bool normal)
|
||||
|
||||
size_t dest_mask_to_comp_count(shader::usse::Imm4 dest_mask);
|
||||
|
||||
spv::Id create_access_chain(spv::Builder &b, const spv::StorageClass storage_class, const spv::Id base, const std::vector<spv::Id> &offsets);
|
||||
|
||||
template <typename T>
|
||||
spv::Id make_uniform_vector_from_type(spv::Builder &b, spv::Id type, T val) {
|
||||
const int num_comp = b.getNumTypeComponents(type);
|
||||
|
@ -761,7 +761,7 @@ static void create_fragment_inputs(spv::Builder &b, SpirvShaderParameters ¶m
|
||||
}
|
||||
translation_state.color_attachment_raw_id = color_attachment_raw;
|
||||
|
||||
spv::Id load_normal_cond = b.createBinOp(spv::OpFOrdLessThan, b.makeBoolType(), b.createAccessChain(spv::StorageClassPrivate, translation_state.render_info_id, { b.makeIntConstant(FRAG_UNIFORM_use_raw_image) }), b.makeFloatConstant(0.5f));
|
||||
spv::Id load_normal_cond = b.createBinOp(spv::OpFOrdLessThan, b.makeBoolType(), utils::create_access_chain(b, spv::StorageClassPrivate, translation_state.render_info_id, { b.makeIntConstant(FRAG_UNIFORM_use_raw_image) }), b.makeFloatConstant(0.5f));
|
||||
spv::Builder::If cond_builder(load_normal_cond, spv::SelectionControlMaskNone, b);
|
||||
|
||||
source = b.createOp(spv::OpImageRead, v4, { b.createLoad(color_attachment, spv::NoPrecision), current_coord });
|
||||
@ -815,17 +815,17 @@ static void copy_uniform_block_to_register(spv::Builder &builder, spv::Id sa_ban
|
||||
int start_in_vec4_granularity = start / 4;
|
||||
|
||||
utils::make_for_loop(builder, ite, builder.makeIntConstant(0), builder.makeIntConstant(vec4_count), [&]() {
|
||||
spv::Id to_copy = builder.createAccessChain(spv::StorageClassStorageBuffer, block, { builder.createLoad(ite, spv::NoPrecision) });
|
||||
spv::Id to_copy = utils::create_access_chain(builder, spv::StorageClassStorageBuffer, block, { builder.createLoad(ite, spv::NoPrecision) });
|
||||
to_copy = builder.createLoad(to_copy, spv::NoPrecision);
|
||||
const spv::Id ite_loaded = builder.createLoad(ite, spv::NoPrecision);
|
||||
const spv::Id ite_type = builder.getTypeId(ite_loaded);
|
||||
spv::Id dest = builder.createAccessChain(spv::StorageClassPrivate, sa_bank, { builder.createBinOp(spv::OpIAdd, ite_type, ite_loaded, builder.makeIntConstant(start_in_vec4_granularity)) });
|
||||
spv::Id dest = utils::create_access_chain(builder, spv::StorageClassPrivate, sa_bank, { builder.createBinOp(spv::OpIAdd, ite_type, ite_loaded, builder.makeIntConstant(start_in_vec4_granularity)) });
|
||||
spv::Id dest_friend = spv::NoResult;
|
||||
|
||||
if (start % 4 == 0) {
|
||||
builder.createStore(to_copy, dest);
|
||||
} else {
|
||||
dest_friend = builder.createAccessChain(spv::StorageClassPrivate, sa_bank, { builder.createBinOp(spv::OpIAdd, ite_type, ite_loaded, builder.makeIntConstant(start_in_vec4_granularity + 1)) });
|
||||
dest_friend = utils::create_access_chain(builder, spv::StorageClassPrivate, sa_bank, { builder.createBinOp(spv::OpIAdd, ite_type, ite_loaded, builder.makeIntConstant(start_in_vec4_granularity + 1)) });
|
||||
|
||||
std::vector<spv::Id> ops_copy_1 = { builder.createLoad(dest, spv::NoPrecision), to_copy };
|
||||
std::vector<spv::Id> ops_copy_2 = { builder.createLoad(dest_friend, spv::NoPrecision), to_copy };
|
||||
@ -946,7 +946,7 @@ static SpirvShaderParameters create_parameters(spv::Builder &b, const SceGxmProg
|
||||
for (const auto &buffer : program_input.uniform_buffers) {
|
||||
if (buffer.reg_block_size > 0) {
|
||||
const uint32_t reg_block_size_in_f32v = std::min<uint32_t>(buffer.reg_block_size + 3, REG_SA_COUNT) / 4;
|
||||
const auto spv_buffer = b.createAccessChain(spv::StorageClassStorageBuffer, spv_params.buffer_container,
|
||||
const auto spv_buffer = utils::create_access_chain(b, spv::StorageClassStorageBuffer, spv_params.buffer_container,
|
||||
{ b.makeIntConstant(spv_params.buffers.at(buffer.index).index_in_container) });
|
||||
copy_uniform_block_to_register(b, spv_params.uniforms, spv_buffer, ite_copy, buffer.reg_start_offset, reg_block_size_in_f32v);
|
||||
}
|
||||
@ -1225,7 +1225,8 @@ static spv::Function *make_frag_finalize_function(spv::Builder &b, const SpirvSh
|
||||
spv::Block *frag_fin_block;
|
||||
spv::Block *last_build_point = b.getBuildPoint();
|
||||
|
||||
spv::Function *frag_fin_func = b.makeFunctionEntry(spv::NoPrecision, b.makeVoidType(), "frag_output_finalize", {},
|
||||
spv::Function *frag_fin_func = b.makeFunctionEntry(
|
||||
spv::NoPrecision, b.makeVoidType(), "frag_output_finalize", {}, {},
|
||||
decorations, &frag_fin_block);
|
||||
|
||||
const SceGxmParameterType param_type = program.get_fragment_output_type();
|
||||
@ -1307,7 +1308,7 @@ static spv::Function *make_frag_finalize_function(spv::Builder &b, const SpirvSh
|
||||
current_coord = b.createOp(spv::OpVectorShuffle, v2i32, { current_coord, current_coord, 0, 1 });
|
||||
|
||||
// the mask is not upscaled
|
||||
spv::Id res_multiplier = b.createAccessChain(spv::StorageClassUniform, translate_state.render_info_id, { b.makeIntConstant(FRAG_UNIFORM_res_multiplier) });
|
||||
spv::Id res_multiplier = utils::create_access_chain(b, spv::StorageClassUniform, translate_state.render_info_id, { b.makeIntConstant(FRAG_UNIFORM_res_multiplier) });
|
||||
res_multiplier = b.createLoad(res_multiplier, spv::NoPrecision);
|
||||
res_multiplier = b.createCompositeConstruct(v2i32, { res_multiplier, res_multiplier });
|
||||
current_coord = b.createBinOp(spv::OpSDiv, v2i32, current_coord, res_multiplier);
|
||||
@ -1320,7 +1321,7 @@ static spv::Function *make_frag_finalize_function(spv::Builder &b, const SpirvSh
|
||||
spv::Id pred = b.createOp(spv::OpFOrdLessThan, b.makeVectorType(b.makeBoolType(), 4), { texel, zero });
|
||||
spv::Id pred2 = b.createUnaryOp(spv::OpAll, b.makeBoolType(), pred);
|
||||
spv::Builder::If cond_builder(pred2, spv::SelectionControlMaskNone, b);
|
||||
b.makeDiscard();
|
||||
b.makeStatementTerminator(spv::OpKill, "discard");
|
||||
cond_builder.makeEndIf();
|
||||
}
|
||||
|
||||
@ -1337,7 +1338,8 @@ static spv::Function *make_vert_finalize_function(spv::Builder &b, const SpirvSh
|
||||
spv::Block *vert_fin_block;
|
||||
spv::Block *last_build_point = b.getBuildPoint();
|
||||
|
||||
spv::Function *vert_fin_func = b.makeFunctionEntry(spv::NoPrecision, b.makeVoidType(), "vert_output_finalize", {},
|
||||
spv::Function *vert_fin_func = b.makeFunctionEntry(
|
||||
spv::NoPrecision, b.makeVoidType(), "vert_output_finalize", {}, {},
|
||||
decorations, &vert_fin_block);
|
||||
|
||||
gxp::GxmVertexOutputTexCoordInfos coord_infos = {};
|
||||
@ -1440,13 +1442,13 @@ static spv::Function *make_vert_finalize_function(spv::Builder &b, const SpirvSh
|
||||
screen_offset = b.makeCompositeConstant(v4, { neg_one, one, zero, zero });
|
||||
}
|
||||
|
||||
const spv::Id viewport_flag = b.createAccessChain(spv::StorageClassUniform, translation_state.render_info_id, { b.makeIntConstant(VERT_UNIFORM_viewport_flag) });
|
||||
const spv::Id viewport_flag = utils::create_access_chain(b, spv::StorageClassUniform, translation_state.render_info_id, { b.makeIntConstant(VERT_UNIFORM_viewport_flag) });
|
||||
const spv::Id pred = b.createOp(spv::OpFOrdLessThan, b.makeBoolType(), { b.createLoad(viewport_flag, spv::NoPrecision), half });
|
||||
spv::Builder::If cond_builder(pred, spv::SelectionControlMaskNone, b);
|
||||
|
||||
spv::Id screen_width = b.createAccessChain(spv::StorageClassUniform, translation_state.render_info_id, { b.makeIntConstant(VERT_UNIFORM_screen_width) });
|
||||
spv::Id screen_width = utils::create_access_chain(b, spv::StorageClassUniform, translation_state.render_info_id, { b.makeIntConstant(VERT_UNIFORM_screen_width) });
|
||||
screen_width = b.createLoad(screen_width, spv::NoPrecision);
|
||||
spv::Id screen_height = b.createAccessChain(spv::StorageClassUniform, translation_state.render_info_id, { b.makeIntConstant(VERT_UNIFORM_screen_height) });
|
||||
spv::Id screen_height = utils::create_access_chain(b, spv::StorageClassUniform, translation_state.render_info_id, { b.makeIntConstant(VERT_UNIFORM_screen_height) });
|
||||
screen_height = b.createLoad(screen_height, spv::NoPrecision);
|
||||
|
||||
// o_val2 = (x,y,z,w) * (2/width, -2/height, 1, 1) + (-1,1,0,0)
|
||||
@ -1457,7 +1459,7 @@ static spv::Function *make_vert_finalize_function(spv::Builder &b, const SpirvSh
|
||||
|
||||
// on vulkan this is done using the viewport directly
|
||||
if (!translation_state.is_vulkan && translation_state.render_info_id != spv::NoResult) {
|
||||
spv::Id flip_vec_id = b.createAccessChain(spv::StorageClassUniform, translation_state.render_info_id, { b.makeIntConstant(VERT_UNIFORM_viewport_flip) });
|
||||
spv::Id flip_vec_id = utils::create_access_chain(b, spv::StorageClassUniform, translation_state.render_info_id, { b.makeIntConstant(VERT_UNIFORM_viewport_flip) });
|
||||
flip_vec_id = b.createLoad(flip_vec_id, spv::NoPrecision);
|
||||
o_val2 = b.createBinOp(spv::OpFMul, v4, o_val2, flip_vec_id);
|
||||
}
|
||||
@ -1466,8 +1468,8 @@ static spv::Function *make_vert_finalize_function(spv::Builder &b, const SpirvSh
|
||||
|
||||
// Note: Depth range and user clip planes are ineffective in this mode
|
||||
// However, that can't be directly translated, so we just gonna set it to w here
|
||||
spv::Id z_ref = b.createAccessChain(spv::StorageClassOutput, out_var, { b.makeIntConstant(2) });
|
||||
spv::Id w_ref = b.createAccessChain(spv::StorageClassOutput, out_var, { b.makeIntConstant(3) });
|
||||
spv::Id z_ref = utils::create_access_chain(b, spv::StorageClassOutput, out_var, { b.makeIntConstant(2) });
|
||||
spv::Id w_ref = utils::create_access_chain(b, spv::StorageClassOutput, out_var, { b.makeIntConstant(3) });
|
||||
|
||||
b.createStore(b.createLoad(w_ref, spv::NoPrecision), z_ref);
|
||||
|
||||
@ -1475,7 +1477,7 @@ static spv::Function *make_vert_finalize_function(spv::Builder &b, const SpirvSh
|
||||
|
||||
// Apply the viewport flip if opengl
|
||||
if (!translation_state.is_vulkan && translation_state.render_info_id != spv::NoResult) {
|
||||
spv::Id flip_vec_id = b.createAccessChain(spv::StorageClassUniform, translation_state.render_info_id, { b.makeIntConstant(VERT_UNIFORM_viewport_flip) });
|
||||
spv::Id flip_vec_id = utils::create_access_chain(b, spv::StorageClassUniform, translation_state.render_info_id, { b.makeIntConstant(VERT_UNIFORM_viewport_flip) });
|
||||
flip_vec_id = b.createLoad(flip_vec_id, spv::NoPrecision);
|
||||
o_val = b.createBinOp(spv::OpFMul, out_type, o_val, flip_vec_id);
|
||||
}
|
||||
@ -1483,13 +1485,13 @@ static spv::Function *make_vert_finalize_function(spv::Builder &b, const SpirvSh
|
||||
|
||||
// scale the depth and w coordinate
|
||||
if (translation_state.render_info_id != spv::NoResult) {
|
||||
spv::Id z_ref = b.createAccessChain(spv::StorageClassOutput, out_var, { b.makeIntConstant(2) });
|
||||
spv::Id w_ref = b.createAccessChain(spv::StorageClassOutput, out_var, { b.makeIntConstant(3) });
|
||||
spv::Id z_ref = utils::create_access_chain(b, spv::StorageClassOutput, out_var, { b.makeIntConstant(2) });
|
||||
spv::Id w_ref = utils::create_access_chain(b, spv::StorageClassOutput, out_var, { b.makeIntConstant(3) });
|
||||
spv::Id z = b.createLoad(z_ref, spv::NoPrecision);
|
||||
const spv::Id w = b.createLoad(w_ref, spv::NoPrecision);
|
||||
|
||||
spv::Id z_offset = b.createAccessChain(spv::StorageClassUniform, translation_state.render_info_id, { b.makeIntConstant(VERT_UNIFORM_z_offset) });
|
||||
spv::Id z_scale = b.createAccessChain(spv::StorageClassUniform, translation_state.render_info_id, { b.makeIntConstant(VERT_UNIFORM_z_scale) });
|
||||
spv::Id z_offset = utils::create_access_chain(b, spv::StorageClassUniform, translation_state.render_info_id, { b.makeIntConstant(VERT_UNIFORM_z_offset) });
|
||||
spv::Id z_scale = utils::create_access_chain(b, spv::StorageClassUniform, translation_state.render_info_id, { b.makeIntConstant(VERT_UNIFORM_z_scale) });
|
||||
z_offset = b.createLoad(z_offset, spv::NoPrecision);
|
||||
z_scale = b.createLoad(z_scale, spv::NoPrecision);
|
||||
|
||||
@ -1534,7 +1536,8 @@ static spv::Function *make_frag_initialize_function(spv::Builder &b, Translation
|
||||
spv::Block *frag_init_block;
|
||||
spv::Block *last_build_point = b.getBuildPoint();
|
||||
|
||||
spv::Function *frag_init_func = b.makeFunctionEntry(spv::NoPrecision, b.makeVoidType(), "frag_init", {},
|
||||
spv::Function *frag_init_func = b.makeFunctionEntry(
|
||||
spv::NoPrecision, b.makeVoidType(), "frag_init", {}, {},
|
||||
decorations, &frag_init_block);
|
||||
|
||||
// Note! We use CCW as Front face, however we invert the coordinates so the front face is actually CW, identical to GXM (GXM also has front-face as CW)
|
||||
@ -1542,8 +1545,8 @@ static spv::Function *make_frag_initialize_function(spv::Builder &b, Translation
|
||||
spv::Id zero = b.makeFloatConstant(0.0f);
|
||||
|
||||
spv::Id front_facing = b.createVariable(spv::NoPrecision, spv::StorageClassInput, booltype, "gl_FrontFacing");
|
||||
spv::Id front_disabled = b.createAccessChain(spv::StorageClassUniform, translate_state.render_info_id, { b.makeIntConstant(FRAG_UNIFORM_front_disabled) });
|
||||
spv::Id back_disabled = b.createAccessChain(spv::StorageClassUniform, translate_state.render_info_id, { b.makeIntConstant(FRAG_UNIFORM_back_disabled) });
|
||||
spv::Id front_disabled = utils::create_access_chain(b, spv::StorageClassUniform, translate_state.render_info_id, { b.makeIntConstant(FRAG_UNIFORM_front_disabled) });
|
||||
spv::Id back_disabled = utils::create_access_chain(b, spv::StorageClassUniform, translate_state.render_info_id, { b.makeIntConstant(FRAG_UNIFORM_back_disabled) });
|
||||
b.addDecoration(front_facing, spv::DecorationBuiltIn, spv::BuiltInFrontFacing);
|
||||
translate_state.interfaces.push_back(front_facing);
|
||||
|
||||
@ -1552,13 +1555,13 @@ static spv::Function *make_frag_initialize_function(spv::Builder &b, Translation
|
||||
spv::Id pred = b.createOp(spv::OpLogicalAnd, booltype, { b.createBinOp(spv::OpFOrdNotEqual, booltype, b.createLoad(front_disabled, spv::NoPrecision), zero), front_facing });
|
||||
|
||||
spv::Builder::If front_disabled_cond_builder(pred, spv::SelectionControlMaskNone, b);
|
||||
b.makeDiscard();
|
||||
b.makeStatementTerminator(spv::OpKill, "kill");
|
||||
front_disabled_cond_builder.makeEndIf();
|
||||
|
||||
pred = b.createOp(spv::OpLogicalAnd, booltype, { b.createBinOp(spv::OpFOrdNotEqual, booltype, b.createLoad(back_disabled, spv::NoPrecision), zero), b.createUnaryOp(spv::OpLogicalNot, booltype, front_facing) });
|
||||
|
||||
spv::Builder::If back_disabled_cond_builder(pred, spv::SelectionControlMaskNone, b);
|
||||
b.makeDiscard();
|
||||
b.makeStatementTerminator(spv::OpKill, "kill");
|
||||
back_disabled_cond_builder.makeEndIf();
|
||||
|
||||
b.makeReturn(false);
|
||||
@ -1568,7 +1571,7 @@ static spv::Function *make_frag_initialize_function(spv::Builder &b, Translation
|
||||
}
|
||||
|
||||
static void generate_update_mask_body(spv::Builder &b, utils::SpirvUtilFunctions &utils, const FeatureState &features, TranslationState &translate_state) {
|
||||
const spv::Id writing_mask_var = b.createAccessChain(spv::StorageClassUniform, translate_state.render_info_id, { b.makeIntConstant(FRAG_UNIFORM_writing_mask) });
|
||||
const spv::Id writing_mask_var = utils::create_access_chain(b, spv::StorageClassUniform, translate_state.render_info_id, { b.makeIntConstant(FRAG_UNIFORM_writing_mask) });
|
||||
const spv::Id writing_mask = b.createLoad(writing_mask_var, spv::NoPrecision);
|
||||
|
||||
const spv::Id v4 = b.makeVectorType(b.makeFloatType(32), 4);
|
||||
@ -1687,7 +1690,7 @@ static SpirvCode convert_gxp_to_spirv_impl(const SceGxmProgram &program, const s
|
||||
spv::Id rezero_v = b.makeCompositeConstant(v4, { rezero, rezero, rezero, rezero });
|
||||
utils::make_for_loop(b, ite, b.makeIntConstant(0), b.makeIntConstant(REG_O_COUNT / 4), [&]() {
|
||||
Operand target_to_store;
|
||||
spv::Id dest = b.createAccessChain(spv::StorageClassPrivate, parameters.outs, { b.createLoad(ite, spv::NoPrecision) });
|
||||
spv::Id dest = utils::create_access_chain(b, spv::StorageClassPrivate, parameters.outs, { b.createLoad(ite, spv::NoPrecision) });
|
||||
b.createStore(rezero_v, dest);
|
||||
});
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ bool USSETranslatorVisitor::kill(
|
||||
LOG_DISASM("{:016x}: KILL {}", m_instr, disasm::s_predicate_str(pred));
|
||||
|
||||
m_b.setLine(m_recompiler.cur_pc);
|
||||
m_b.makeDiscard();
|
||||
m_b.makeStatementTerminator(spv::OpKill, "kill");
|
||||
|
||||
return true;
|
||||
}
|
@ -1017,7 +1017,7 @@ spv::Function *USSERecompiler::compile_program_function() {
|
||||
|
||||
const auto sub_name = fmt::format("{}_program", visitor.is_translating_secondary_program() ? "secondary" : "primary");
|
||||
|
||||
spv::Function *ret_func = b.makeFunctionEntry(spv::NoPrecision, b.makeVoidType(), sub_name.c_str(), {}, {},
|
||||
spv::Function *ret_func = b.makeFunctionEntry(spv::NoPrecision, b.makeVoidType(), sub_name.c_str(), {}, {}, {},
|
||||
&new_sub_block);
|
||||
|
||||
compile_block(tree_block_node);
|
||||
|
@ -104,6 +104,14 @@ size_t shader::usse::utils::dest_mask_to_comp_count(shader::usse::Imm4 dest_mask
|
||||
return bit_count;
|
||||
}
|
||||
|
||||
spv::Id shader::usse::utils::create_access_chain(spv::Builder& b, const spv::StorageClass storage_class, const spv::Id base, const std::vector<spv::Id>& offsets) {
|
||||
spv::Builder::AccessChain access_chain{};
|
||||
access_chain.base = base;
|
||||
access_chain.indexChain = offsets;
|
||||
b.setAccessChain(access_chain);
|
||||
return b.createAccessChain(storage_class, base, offsets);
|
||||
}
|
||||
|
||||
static const shader::usse::SpirvVarRegBank *get_reg_bank(const shader::usse::SpirvShaderParameters ¶ms, shader::usse::RegisterBank reg_bank) {
|
||||
switch (reg_bank) {
|
||||
case shader::usse::RegisterBank::PRIMATTR:
|
||||
@ -142,7 +150,8 @@ static spv::Function *make_fx8_unpack_func(spv::Builder &b, const FeatureState &
|
||||
spv::Id type_f32_v4 = b.makeVectorType(type_f32, 4);
|
||||
spv::Id max_fx8_c = b.makeFloatConstant(MAX_FX8);
|
||||
|
||||
spv::Function *fx8_unpack_func = b.makeFunctionEntry(spv::NoPrecision, type_f32_v4, "unpack4xF8", { type_f32 },
|
||||
spv::Function *fx8_unpack_func = b.makeFunctionEntry(
|
||||
spv::NoPrecision, type_f32_v4, "unpack4xF8", { type_f32 }, { "to_unpack" },
|
||||
decorations, &fx8_unpack_func_block);
|
||||
|
||||
spv::Id extracted = fx8_unpack_func->getParamId(0);
|
||||
@ -171,7 +180,8 @@ static spv::Function *make_fx8_pack_func(spv::Builder &b, const FeatureState &fe
|
||||
spv::Id type_f32_v4 = b.makeVectorType(type_f32, 4);
|
||||
spv::Id max_fx8_c = b.makeFloatConstant(MAX_FX8);
|
||||
|
||||
spv::Function *fx8_pack_func = b.makeFunctionEntry(spv::NoPrecision, type_f32, "pack4xF8", { type_f32_v4 },
|
||||
spv::Function *fx8_pack_func = b.makeFunctionEntry(
|
||||
spv::NoPrecision, type_f32, "pack4xF8", { type_f32_v4 }, { "to_pack" },
|
||||
decorations, &fx8_pack_func_block);
|
||||
|
||||
spv::Id extracted = fx8_pack_func->getParamId(0);
|
||||
@ -233,7 +243,8 @@ static spv::Function *make_unpack_func(spv::Builder &b, const FeatureState &feat
|
||||
assert(false);
|
||||
}
|
||||
|
||||
spv::Function *unpack_func = b.makeFunctionEntry(spv::NoPrecision, output_type, func_name.c_str(), { type_f32 },
|
||||
spv::Function *unpack_func = b.makeFunctionEntry(
|
||||
spv::NoPrecision, output_type, func_name.c_str(), { type_f32 }, { "to_unpack" },
|
||||
decorations, &unpack_func_block);
|
||||
spv::Id extracted = unpack_func->getParamId(0);
|
||||
|
||||
@ -324,7 +335,8 @@ static spv::Function *make_pack_func(spv::Builder &b, const FeatureState &featur
|
||||
assert(false);
|
||||
}
|
||||
|
||||
spv::Function *pack_func = b.makeFunctionEntry(spv::NoPrecision, type_f32, func_name.c_str(), { input_type },
|
||||
spv::Function *pack_func = b.makeFunctionEntry(
|
||||
spv::NoPrecision, type_f32, func_name.c_str(), { input_type }, { "to_pack" },
|
||||
decorations, &pack_func_block);
|
||||
|
||||
spv::Id extracted = pack_func->getParamId(0);
|
||||
@ -361,7 +373,8 @@ static spv::Function *make_f16_unpack_func(spv::Builder &b, const FeatureState &
|
||||
spv::Id type_f32 = b.makeFloatType(32);
|
||||
spv::Id type_f32_v2 = b.makeVectorType(type_f32, 2);
|
||||
|
||||
spv::Function *f16_unpack_func = b.makeFunctionEntry(spv::NoPrecision, type_f32_v2, "unpack2xF16", { type_f32 },
|
||||
spv::Function *f16_unpack_func = b.makeFunctionEntry(
|
||||
spv::NoPrecision, type_f32_v2, "unpack2xF16", { type_f32 }, { "to_unpack" },
|
||||
decorations, &f16_unpack_func_block);
|
||||
|
||||
spv::Id extracted = f16_unpack_func->getParamId(0);
|
||||
@ -385,7 +398,8 @@ static spv::Function *make_f16_pack_func(spv::Builder &b, const FeatureState &fe
|
||||
spv::Id type_f32 = b.makeFloatType(32);
|
||||
spv::Id type_f32_v2 = b.makeVectorType(type_f32, 2);
|
||||
|
||||
spv::Function *f16_pack_func = b.makeFunctionEntry(spv::NoPrecision, type_f32, "pack2xF16", { type_f32_v2 },
|
||||
spv::Function *f16_pack_func = b.makeFunctionEntry(
|
||||
spv::NoPrecision, type_f32, "pack2xF16", { type_f32_v2 }, { "to_pack" },
|
||||
decorations, &f16_pack_func_block);
|
||||
|
||||
spv::Id extracted = f16_pack_func->getParamId(0);
|
||||
@ -416,7 +430,7 @@ static spv::Function *make_fetch_memory_func_for_array(spv::Builder &b, spv::Id
|
||||
|
||||
const std::string func_name = fmt::format("fetchMemoryForBuffer{}Base{}", buffer_index, info.base);
|
||||
|
||||
spv::Function *fetch_func = b.makeFunctionEntry(spv::NoPrecision, type_f32, func_name.c_str(), { type_i32 },
|
||||
spv::Function *fetch_func = b.makeFunctionEntry(spv::NoPrecision, type_f32, func_name.c_str(), { type_i32 }, { "addr" },
|
||||
{}, &func_block);
|
||||
|
||||
spv::Id sixteen_cst = b.makeIntConstant(16);
|
||||
@ -440,14 +454,14 @@ static spv::Function *make_fetch_memory_func_for_array(spv::Builder &b, spv::Id
|
||||
spv::Id rem_in_bits = b.createBinOp(spv::OpIMul, type_i32, rem, eight_cst);
|
||||
spv::Id rem_inv_in_bits = b.createBinOp(spv::OpIMul, type_i32, rem_inv, eight_cst);
|
||||
|
||||
spv::Id src = b.createLoad(b.createAccessChain(spv::StorageClassStorageBuffer, buffer_container, { b.makeIntConstant(info.index_in_container), base_vector, base_offset }), spv::NoPrecision);
|
||||
spv::Id src = b.createLoad(utils::create_access_chain(b, spv::StorageClassStorageBuffer, buffer_container, { b.makeIntConstant(info.index_in_container), base_vector, base_offset }), spv::NoPrecision);
|
||||
|
||||
spv::Id friend_offset = b.createBinOp(spv::OpIAdd, type_i32, base_offset, one_cst);
|
||||
spv::Id friend_vector = b.createBinOp(spv::OpIAdd, type_i32, base_vector, b.createBinOp(spv::OpSDiv, type_i32, friend_offset, b.makeIntConstant(4)));
|
||||
|
||||
friend_offset = b.createBinOp(spv::OpSRem, type_i32, friend_offset, four_cst);
|
||||
|
||||
spv::Id src_friend = b.createLoad(b.createAccessChain(spv::StorageClassStorageBuffer, buffer_container, { b.makeIntConstant(info.index_in_container), friend_vector, friend_offset }), spv::NoPrecision);
|
||||
spv::Id src_friend = b.createLoad(utils::create_access_chain(b, spv::StorageClassStorageBuffer, buffer_container, { b.makeIntConstant(info.index_in_container), friend_vector, friend_offset }), spv::NoPrecision);
|
||||
spv::Id src_casted = b.createUnaryOp(spv::OpBitcast, type_ui32, src);
|
||||
spv::Id src_friend_casted = b.createUnaryOp(spv::OpBitcast, type_ui32, src_friend);
|
||||
|
||||
@ -472,7 +486,7 @@ static spv::Function *make_fetch_memory_func(spv::Builder &b, const SpirvShaderP
|
||||
spv::Block *func_block;
|
||||
spv::Block *last_build_point = b.getBuildPoint();
|
||||
|
||||
spv::Function *fetch_func = b.makeFunctionEntry(spv::NoPrecision, type_f32, "fetchMemory", { type_i32 },
|
||||
spv::Function *fetch_func = b.makeFunctionEntry(spv::NoPrecision, type_f32, "fetchMemory", { type_i32 }, { "addr" },
|
||||
{}, &func_block);
|
||||
spv::Id addr = fetch_func->getParamId(0);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user