Merge branch 'master' into vk_vfetch

# Conflicts:
#	src/xenia/gpu/spirv_shader_translator.cc
This commit is contained in:
DrChat 2018-01-01 18:30:29 -06:00
commit 10f74fc45a
5 changed files with 32 additions and 29 deletions

View File

@ -210,7 +210,7 @@ int xenia_main(const std::vector<std::wstring>& args) {
std::wstring abs_path = xe::to_absolute_path(path);
result = emulator->LaunchPath(abs_path);
if (XFAILED(result)) {
XELOGE("Failed to launch target: %.8X", result);
xe::FatalError("Failed to launch target: %.8X", result);
emulator.reset();
emulator_window.reset();
return 1;

View File

@ -225,6 +225,11 @@ bool XmaContext::ValidFrameOffset(uint8_t* block, size_t size_bytes,
size_t frame_offset_bits) {
uint32_t packet_num =
GetFramePacketNumber(block, size_bytes, frame_offset_bits);
if (packet_num == -1) {
// Invalid packet number
return false;
}
uint8_t* packet = block + (packet_num * kBytesPerPacket);
size_t relative_offset_bits = frame_offset_bits % (kBytesPerPacket * 8);

View File

@ -1263,7 +1263,10 @@ void SpirvShaderTranslator::ProcessVertexFetchInstruction(
assert_unhandled_case(vertex_components);
}
spv::Id vertex = 0;
auto vertex_ptr = vertex_binding_map_[instr.operands[1].storage_index]
[instr.attributes.offset];
assert_not_zero(vertex_ptr);
spv::Id vertex = b.createLoad(vertex_ptr);
switch (instr.attributes.data_format) {
case VertexFormat::k_8_8_8_8:
case VertexFormat::k_2_10_10_10:
@ -1277,13 +1280,9 @@ void SpirvShaderTranslator::ProcessVertexFetchInstruction(
case VertexFormat::k_32_FLOAT:
case VertexFormat::k_32_32_FLOAT:
case VertexFormat::k_32_32_32_FLOAT:
case VertexFormat::k_32_32_32_32_FLOAT:
case VertexFormat::k_32_32_32_32_FLOAT: {
// These are handled, for now.
auto vertex_ptr = vertex_binding_map_[instr.operands[1].storage_index]
[instr.attributes.offset];
assert_not_zero(vertex_ptr);
vertex = b.createLoad(vertex_ptr);
break;
} break;
case VertexFormat::k_10_11_11: {
// This needs to be converted.

View File

@ -70,32 +70,30 @@ VkResult BufferCache::Initialize() {
// Create the descriptor set layout used for our uniform buffer.
// As it is a static binding that uses dynamic offsets during draws we can
// create this once and reuse it forever.
VkDescriptorSetLayoutBinding vertex_uniform_binding;
vertex_uniform_binding.binding = 0;
vertex_uniform_binding.descriptorType =
VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC;
vertex_uniform_binding.descriptorCount = 1;
vertex_uniform_binding.stageFlags = VK_SHADER_STAGE_VERTEX_BIT;
vertex_uniform_binding.pImmutableSamplers = nullptr;
VkDescriptorSetLayoutBinding fragment_uniform_binding;
fragment_uniform_binding.binding = 1;
fragment_uniform_binding.descriptorType =
VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC;
fragment_uniform_binding.descriptorCount = 1;
fragment_uniform_binding.stageFlags = VK_SHADER_STAGE_FRAGMENT_BIT;
fragment_uniform_binding.pImmutableSamplers = nullptr;
VkDescriptorSetLayoutCreateInfo descriptor_set_layout_info;
VkDescriptorSetLayoutBinding bindings[2] = {};
// Vertex constants
bindings[0].binding = 0;
bindings[0].descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC;
bindings[0].descriptorCount = 1;
bindings[0].stageFlags = VK_SHADER_STAGE_VERTEX_BIT;
bindings[0].pImmutableSamplers = nullptr;
// Fragment constants
bindings[1].binding = 1;
bindings[1].descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC;
bindings[1].descriptorCount = 1;
bindings[1].stageFlags = VK_SHADER_STAGE_FRAGMENT_BIT;
bindings[1].pImmutableSamplers = nullptr;
VkDescriptorSetLayoutCreateInfo descriptor_set_layout_info = {};
descriptor_set_layout_info.sType =
VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO;
descriptor_set_layout_info.pNext = nullptr;
descriptor_set_layout_info.flags = 0;
VkDescriptorSetLayoutBinding uniform_bindings[] = {
vertex_uniform_binding,
fragment_uniform_binding,
};
descriptor_set_layout_info.bindingCount =
static_cast<uint32_t>(xe::countof(uniform_bindings));
descriptor_set_layout_info.pBindings = uniform_bindings;
static_cast<uint32_t>(xe::countof(bindings));
descriptor_set_layout_info.pBindings = bindings;
status = vkCreateDescriptorSetLayout(*device_, &descriptor_set_layout_info,
nullptr, &descriptor_set_layout_);
if (status != VK_SUCCESS) {

View File

@ -100,6 +100,7 @@ bool VulkanDevice::Initialize(DeviceInfo device_info) {
}
ENABLE_AND_EXPECT(shaderClipDistance);
ENABLE_AND_EXPECT(shaderCullDistance);
ENABLE_AND_EXPECT(shaderStorageImageExtendedFormats);
ENABLE_AND_EXPECT(shaderTessellationAndGeometryPointSize);
ENABLE_AND_EXPECT(geometryShader);
ENABLE_AND_EXPECT(depthClamp);