00cc9309cb
de6e324bdseparate emu thread10d3daf86Roms List improvements95d202f37Let's make the rom list process on a separate thread so the emulator doesnt take ages to load.fc306967fWow the ROM Header was just completely busted. Game list view works nowbad1691eefuck this shit2b59e5f46game list in progressd26417b83remappable inputs in progressac4af8106inpute72abc240update readme430139dc9Qt6 frontend3080d4d45Fix this small bug too08cd13b85Cop0 unused functions do not actually pose a threat (as per manual). They don't do anything, so shall we.61bb4fb44make idle loop detection a little more specific with where the load goesb037de4c3SAZDFsdff12e81e73eneed to figure out why n64-systemtest loops indefinitely at some address that appears to be valid (i think it's me not invalidating the cache properly)204f0e13bidle skipping seems to work!cb8bb634asdkfjlasdf58e5c89c1Fix compilation issue on my machine (no idea)24fb2898eattempting more serious idle skipping214719577Place rsp.Step inside cached interpreter. Gains about 3 more fpsbb97dcc23mmmmm920b77d38wjkhasdfjhkasdf430ccdab4it's a start...4f42a673aCached interpreter plays Mario 64. Start looking into RSP as wellc9a030787idle skipping works!5fbda03cenew idea366637abaIdle skipping... maybe?609fa2fb0Cache instructions implemented but broken lmao. Commented out for nowe140a6d12- Stop using inheritance for CPU, instead use composition. - Introduce KAIZEN_JIT_ENABLED optional define instead of relying on __aarch64__ and the like. - More cache work68e613057prep cache impl811b4d809fix clang formatfda755f7didkd5024ebbfsmall MI refactor in preparation of (eventually) implementing the RDRAM interface properly694b45341Merge commit '206dcdedf195fb320913584180edb12c7731e396' as 'external/SDL'206dcdedfSquashed 'external/SDL/' content from commit 4d17b99d0a4d16e1cb4need to update sdl848b19920Fix compilation errordb61b5299Merge commit 'e94a94559f28e49678fbcf72199a5258137b0fe9' as 'external/imgui'e94a94559Squashed 'external/imgui/' content from commit 02e9b8cac52edb3757need to update imguic1a705e86Emulate weird JALR behaviour4b4c32f4bFix exception for "unusable COP1" in 4 instructions i missed accidentally (again)df5828142Bug putting 0s in the log everywheref8b580048Make isviewer a sink to file8241e9735Fix exception for "unusable COP1" in 4 instructions i missed accidentallyb29715f20small changesd9a620bc1make use of my new small utility library0d1aa938eAdd 'external/ircolib/' from commit 'ce3cd726c8df8388d554abf8bb55d55020eb4450'e64eb40b3Fuck git git-subtree-dir: external/ircolib git-subtree-split:de6e324bde
229 lines
6.0 KiB
C++
229 lines
6.0 KiB
C++
/* Copyright (c) 2017-2023 Hans-Kristian Arntzen
|
|
*
|
|
* Permission is hereby granted, free of charge, to any person obtaining
|
|
* a copy of this software and associated documentation files (the
|
|
* "Software"), to deal in the Software without restriction, including
|
|
* without limitation the rights to use, copy, modify, merge, publish,
|
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
* permit persons to whom the Software is furnished to do so, subject to
|
|
* the following conditions:
|
|
*
|
|
* The above copyright notice and this permission notice shall be
|
|
* included in all copies or substantial portions of the Software.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "cookie.hpp"
|
|
#include "descriptor_set.hpp"
|
|
#include "hash.hpp"
|
|
#include "intrusive.hpp"
|
|
#include "limits.hpp"
|
|
#include "vulkan_headers.hpp"
|
|
#include "enum_cast.hpp"
|
|
|
|
namespace spirv_cross
|
|
{
|
|
struct SPIRType;
|
|
}
|
|
|
|
namespace Vulkan
|
|
{
|
|
class Device;
|
|
|
|
enum class ShaderStage
|
|
{
|
|
Vertex = 0,
|
|
TessControl = 1,
|
|
TessEvaluation = 2,
|
|
Geometry = 3,
|
|
Fragment = 4,
|
|
Compute = 5,
|
|
Task = 6,
|
|
Mesh = 7,
|
|
Count
|
|
};
|
|
|
|
struct ResourceLayout
|
|
{
|
|
DescriptorSetLayout sets[VULKAN_NUM_DESCRIPTOR_SETS];
|
|
uint32_t input_mask = 0;
|
|
uint32_t output_mask = 0;
|
|
uint32_t push_constant_size = 0;
|
|
uint32_t spec_constant_mask = 0;
|
|
uint32_t bindless_set_mask = 0;
|
|
enum { Version = 4 };
|
|
|
|
bool unserialize(const uint8_t *data, size_t size);
|
|
bool serialize(uint8_t *data, size_t size) const;
|
|
static size_t serialization_size();
|
|
};
|
|
static_assert(sizeof(DescriptorSetLayout) % 8 == 0, "Size of DescriptorSetLayout does not align to 64 bits.");
|
|
|
|
struct CombinedResourceLayout
|
|
{
|
|
uint32_t attribute_mask = 0;
|
|
uint32_t render_target_mask = 0;
|
|
DescriptorSetLayout sets[VULKAN_NUM_DESCRIPTOR_SETS] = {};
|
|
uint32_t stages_for_bindings[VULKAN_NUM_DESCRIPTOR_SETS][VULKAN_NUM_BINDINGS] = {};
|
|
uint32_t stages_for_sets[VULKAN_NUM_DESCRIPTOR_SETS] = {};
|
|
VkPushConstantRange push_constant_range = {};
|
|
uint32_t descriptor_set_mask = 0;
|
|
uint32_t bindless_descriptor_set_mask = 0;
|
|
uint32_t spec_constant_mask[Util::ecast(ShaderStage::Count)] = {};
|
|
uint32_t combined_spec_constant_mask = 0;
|
|
Util::Hash push_constant_layout_hash = 0;
|
|
};
|
|
|
|
union ResourceBinding
|
|
{
|
|
struct
|
|
{
|
|
VkDescriptorBufferInfo dynamic;
|
|
VkDescriptorBufferInfo push;
|
|
} buffer;
|
|
|
|
struct
|
|
{
|
|
VkDescriptorImageInfo fp;
|
|
VkDescriptorImageInfo integer;
|
|
} image;
|
|
|
|
VkBufferView buffer_view;
|
|
};
|
|
|
|
struct ResourceBindings
|
|
{
|
|
ResourceBinding bindings[VULKAN_NUM_DESCRIPTOR_SETS][VULKAN_NUM_BINDINGS];
|
|
uint64_t cookies[VULKAN_NUM_DESCRIPTOR_SETS][VULKAN_NUM_BINDINGS];
|
|
uint64_t secondary_cookies[VULKAN_NUM_DESCRIPTOR_SETS][VULKAN_NUM_BINDINGS];
|
|
uint8_t push_constant_data[VULKAN_PUSH_CONSTANT_SIZE];
|
|
};
|
|
|
|
struct ImmutableSamplerBank
|
|
{
|
|
const ImmutableSampler *samplers[VULKAN_NUM_DESCRIPTOR_SETS][VULKAN_NUM_BINDINGS];
|
|
static void hash(Util::Hasher &h, const ImmutableSamplerBank *bank);
|
|
};
|
|
|
|
class PipelineLayout : public HashedObject<PipelineLayout>
|
|
{
|
|
public:
|
|
PipelineLayout(Util::Hash hash, Device *device, const CombinedResourceLayout &layout,
|
|
const ImmutableSamplerBank *sampler_bank);
|
|
~PipelineLayout();
|
|
|
|
const CombinedResourceLayout &get_resource_layout() const
|
|
{
|
|
return layout;
|
|
}
|
|
|
|
VkPipelineLayout get_layout() const
|
|
{
|
|
return pipe_layout;
|
|
}
|
|
|
|
DescriptorSetAllocator *get_allocator(unsigned set) const
|
|
{
|
|
return set_allocators[set];
|
|
}
|
|
|
|
VkDescriptorUpdateTemplate get_update_template(unsigned set) const
|
|
{
|
|
return update_template[set];
|
|
}
|
|
|
|
uint32_t get_push_set_index() const
|
|
{
|
|
return push_set_index;
|
|
}
|
|
|
|
private:
|
|
Device *device;
|
|
VkPipelineLayout pipe_layout = VK_NULL_HANDLE;
|
|
CombinedResourceLayout layout;
|
|
DescriptorSetAllocator *set_allocators[VULKAN_NUM_DESCRIPTOR_SETS] = {};
|
|
VkDescriptorUpdateTemplate update_template[VULKAN_NUM_DESCRIPTOR_SETS] = {};
|
|
uint32_t push_set_index = UINT32_MAX;
|
|
void create_update_templates();
|
|
};
|
|
|
|
class Shader : public HashedObject<Shader>
|
|
{
|
|
public:
|
|
Shader(Util::Hash binding, Device *device, const uint32_t *data, size_t size,
|
|
const ResourceLayout *layout = nullptr);
|
|
~Shader();
|
|
|
|
const ResourceLayout &get_layout() const
|
|
{
|
|
return layout;
|
|
}
|
|
|
|
VkShaderModule get_module() const
|
|
{
|
|
return module;
|
|
}
|
|
|
|
static bool reflect_resource_layout(ResourceLayout &layout, const uint32_t *spirv_data, size_t spirv_size);
|
|
static const char *stage_to_name(ShaderStage stage);
|
|
static Util::Hash hash(const uint32_t *data, size_t size);
|
|
|
|
private:
|
|
Device *device;
|
|
VkShaderModule module = VK_NULL_HANDLE;
|
|
ResourceLayout layout;
|
|
};
|
|
|
|
struct Pipeline
|
|
{
|
|
VkPipeline pipeline;
|
|
uint32_t dynamic_mask;
|
|
};
|
|
|
|
class Program : public HashedObject<Program>
|
|
{
|
|
public:
|
|
Program(Device *device, Shader *vertex, Shader *fragment, const ImmutableSamplerBank *sampler_bank);
|
|
Program(Device *device, Shader *task, Shader *mesh, Shader *fragment, const ImmutableSamplerBank *sampler_bank);
|
|
Program(Device *device, Shader *compute, const ImmutableSamplerBank *sampler_bank);
|
|
~Program();
|
|
|
|
inline const Shader *get_shader(ShaderStage stage) const
|
|
{
|
|
return shaders[Util::ecast(stage)];
|
|
}
|
|
|
|
void set_pipeline_layout(const PipelineLayout *new_layout)
|
|
{
|
|
layout = new_layout;
|
|
}
|
|
|
|
const PipelineLayout *get_pipeline_layout() const
|
|
{
|
|
return layout;
|
|
}
|
|
|
|
Pipeline get_pipeline(Util::Hash hash) const;
|
|
Pipeline add_pipeline(Util::Hash hash, const Pipeline &pipeline);
|
|
|
|
void promote_read_write_to_read_only();
|
|
|
|
private:
|
|
void set_shader(ShaderStage stage, Shader *handle);
|
|
Device *device;
|
|
Shader *shaders[Util::ecast(ShaderStage::Count)] = {};
|
|
const PipelineLayout *layout = nullptr;
|
|
VulkanCache<Util::IntrusivePODWrapper<Pipeline>> pipelines;
|
|
void destroy_pipeline(const Pipeline &pipeline);
|
|
};
|
|
}
|