mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-12-29 14:25:30 +03:00
Reformat maxwell3d interconnect codebase
This commit is contained in:
parent
3766be59e7
commit
62a165b51e
@ -49,7 +49,7 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
bool VertexBufferState::Refresh(InterconnectContext &ctx, StateUpdateBuilder &builder) {
|
bool VertexBufferState::Refresh(InterconnectContext &ctx, StateUpdateBuilder &builder) {
|
||||||
if (megaBufferBinding) {
|
if (megaBufferBinding) {
|
||||||
if (auto newMegaBufferBinding{view->TryMegaBuffer(ctx.executor.cycle, ctx.executor.AcquireMegaBufferAllocator(), ctx.executor.executionNumber)};
|
if (auto newMegaBufferBinding{view->TryMegaBuffer(ctx.executor.cycle, ctx.executor.AcquireMegaBufferAllocator(), ctx.executor.executionNumber)};
|
||||||
newMegaBufferBinding != megaBufferBinding) {
|
newMegaBufferBinding != megaBufferBinding) {
|
||||||
|
|
||||||
megaBufferBinding = newMegaBufferBinding;
|
megaBufferBinding = newMegaBufferBinding;
|
||||||
if (megaBufferBinding)
|
if (megaBufferBinding)
|
||||||
|
@ -15,7 +15,7 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
dirty::BoundSubresource<EngineRegisters> engine;
|
dirty::BoundSubresource <EngineRegisters> engine;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ConstantBufferSelectorState(dirty::Handle dirtyHandle, DirtyManager &manager, const EngineRegisters &engine);
|
ConstantBufferSelectorState(dirty::Handle dirtyHandle, DirtyManager &manager, const EngineRegisters &engine);
|
||||||
@ -32,7 +32,7 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
struct ConstantBuffer {
|
struct ConstantBuffer {
|
||||||
BufferView view;
|
BufferView view;
|
||||||
|
|
||||||
void Read(CommandExecutor &executor, span<u8> dstBuffer, size_t srcOffset);
|
void Read(CommandExecutor &executor, span <u8> dstBuffer, size_t srcOffset);
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T Read(CommandExecutor &executor, size_t srcOffset) {
|
T Read(CommandExecutor &executor, size_t srcOffset) {
|
||||||
@ -49,7 +49,7 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
*/
|
*/
|
||||||
class ConstantBuffers {
|
class ConstantBuffers {
|
||||||
private:
|
private:
|
||||||
dirty::ManualDirtyState<ConstantBufferSelectorState> selectorState;
|
dirty::ManualDirtyState <ConstantBufferSelectorState> selectorState;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ConstantBufferSet boundConstantBuffers;
|
ConstantBufferSet boundConstantBuffers;
|
||||||
@ -68,7 +68,7 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
|
|
||||||
void MarkAllDirty();
|
void MarkAllDirty();
|
||||||
|
|
||||||
void Load(InterconnectContext &ctx, span<u32> data, u32 offset);
|
void Load(InterconnectContext &ctx, span <u32> data, u32 offset);
|
||||||
|
|
||||||
void Bind(InterconnectContext &ctx, engine::ShaderStage stage, size_t index);
|
void Bind(InterconnectContext &ctx, engine::ShaderStage stage, size_t index);
|
||||||
|
|
||||||
|
@ -152,9 +152,9 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
|
|
||||||
static VkColorComponentFlags ConvertColorWriteMask(engine::CtWrite write) {
|
static VkColorComponentFlags ConvertColorWriteMask(engine::CtWrite write) {
|
||||||
return (write.rEnable ? VK_COLOR_COMPONENT_R_BIT : 0) |
|
return (write.rEnable ? VK_COLOR_COMPONENT_R_BIT : 0) |
|
||||||
(write.gEnable ? VK_COLOR_COMPONENT_G_BIT : 0) |
|
(write.gEnable ? VK_COLOR_COMPONENT_G_BIT : 0) |
|
||||||
(write.bEnable ? VK_COLOR_COMPONENT_B_BIT : 0) |
|
(write.bEnable ? VK_COLOR_COMPONENT_B_BIT : 0) |
|
||||||
(write.aEnable ? VK_COLOR_COMPONENT_A_BIT : 0);
|
(write.aEnable ? VK_COLOR_COMPONENT_A_BIT : 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
static u8 ConvertBlendOp(engine::BlendOp op) {
|
static u8 ConvertBlendOp(engine::BlendOp op) {
|
||||||
|
@ -174,8 +174,8 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
ctx.gpu.shader.ResetPools();
|
ctx.gpu.shader.ResetPools();
|
||||||
|
|
||||||
using PipelineStage = engine::Pipeline::Shader::Type;
|
using PipelineStage = engine::Pipeline::Shader::Type;
|
||||||
auto pipelineStage{[](size_t i){ return static_cast<PipelineStage>(i); }};
|
auto pipelineStage{[](size_t i) { return static_cast<PipelineStage>(i); }};
|
||||||
auto stageIdx{[](PipelineStage stage){ return static_cast<u8>(stage); }};
|
auto stageIdx{[](PipelineStage stage) { return static_cast<u8>(stage); }};
|
||||||
|
|
||||||
std::array<Shader::IR::Program, engine::PipelineCount> programs;
|
std::array<Shader::IR::Program, engine::PipelineCount> programs;
|
||||||
bool ignoreVertexCullBeforeFetch{};
|
bool ignoreVertexCullBeforeFetch{};
|
||||||
@ -233,7 +233,7 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
|
|
||||||
auto &stageDescInfo{descriptorInfo.stages[i]};
|
auto &stageDescInfo{descriptorInfo.stages[i]};
|
||||||
|
|
||||||
auto pushBindings{[&](vk::DescriptorType type, const auto &descs, u32 &count, auto &&descCb, bool individualDescWrites = false) {
|
auto pushBindings{[&](vk::DescriptorType type, const auto &descs, u32 &count, auto &&descCb, bool individualDescWrites = false) {
|
||||||
descriptorInfo.totalWriteDescCount += individualDescWrites ? descs.size() : ((descs.size() > 0) ? 1 : 0);
|
descriptorInfo.totalWriteDescCount += individualDescWrites ? descs.size() : ((descs.size() > 0) ? 1 : 0);
|
||||||
|
|
||||||
for (u32 descIdx{}; descIdx < descs.size(); descIdx++) {
|
for (u32 descIdx{}; descIdx < descs.size(); descIdx++) {
|
||||||
@ -328,7 +328,7 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
numericalType = engine::VertexAttribute::NumericalType::Uint;
|
numericalType = engine::VertexAttribute::NumericalType::Uint;
|
||||||
|
|
||||||
switch (componentBitWidths | numericalType) {
|
switch (componentBitWidths | numericalType) {
|
||||||
/* 8-bit components */
|
/* 8-bit components */
|
||||||
FORMAT_NORM_INT_SCALED_CASE(R8, eR8);
|
FORMAT_NORM_INT_SCALED_CASE(R8, eR8);
|
||||||
FORMAT_NORM_INT_SCALED_CASE(R8_G8, eR8G8);
|
FORMAT_NORM_INT_SCALED_CASE(R8_G8, eR8G8);
|
||||||
FORMAT_NORM_INT_SCALED_CASE(G8R8, eR8G8);
|
FORMAT_NORM_INT_SCALED_CASE(G8R8, eR8G8);
|
||||||
@ -429,21 +429,23 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
for (u32 i{}; i < engine::VertexStreamCount; i++) {
|
for (u32 i{}; i < engine::VertexStreamCount; i++) {
|
||||||
const auto &binding{packedState.vertexBindings[i]};
|
const auto &binding{packedState.vertexBindings[i]};
|
||||||
bindingDescs.push_back({
|
bindingDescs.push_back({
|
||||||
.binding = i,
|
.binding = i,
|
||||||
.stride = binding.stride,
|
.stride = binding.stride,
|
||||||
.inputRate = binding.GetInputRate(),
|
.inputRate = binding.GetInputRate(),
|
||||||
});
|
});
|
||||||
|
|
||||||
if (binding.GetInputRate() == vk::VertexInputRate::eInstance) {
|
if (binding.GetInputRate() == vk::VertexInputRate::eInstance) {
|
||||||
if (!ctx.gpu.traits.supportsVertexAttributeDivisor) [[unlikely]]
|
if (!ctx.gpu.traits.supportsVertexAttributeDivisor)
|
||||||
|
[[unlikely]]
|
||||||
Logger::Warn("Vertex attribute divisor used on guest without host support");
|
Logger::Warn("Vertex attribute divisor used on guest without host support");
|
||||||
else if (!ctx.gpu.traits.supportsVertexAttributeZeroDivisor && binding.divisor == 0) [[unlikely]]
|
else if (!ctx.gpu.traits.supportsVertexAttributeZeroDivisor && binding.divisor == 0)
|
||||||
|
[[unlikely]]
|
||||||
Logger::Warn("Vertex attribute zero divisor used on guest without host support");
|
Logger::Warn("Vertex attribute zero divisor used on guest without host support");
|
||||||
else
|
else
|
||||||
bindingDivisorDescs.push_back({
|
bindingDivisorDescs.push_back({
|
||||||
.binding = i,
|
.binding = i,
|
||||||
.divisor = binding.divisor,
|
.divisor = binding.divisor,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -451,11 +453,11 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
const auto &attribute{packedState.vertexAttributes[i]};
|
const auto &attribute{packedState.vertexAttributes[i]};
|
||||||
if (attribute.source == engine::VertexAttribute::Source::Active && shaderStages[0].info.loads.Generic(i))
|
if (attribute.source == engine::VertexAttribute::Source::Active && shaderStages[0].info.loads.Generic(i))
|
||||||
attributeDescs.push_back({
|
attributeDescs.push_back({
|
||||||
.location = i,
|
.location = i,
|
||||||
.binding = attribute.stream,
|
.binding = attribute.stream,
|
||||||
.format = ConvertVertexInputAttributeFormat(attribute.componentBitWidths, attribute.numericalType),
|
.format = ConvertVertexInputAttributeFormat(attribute.componentBitWidths, attribute.numericalType),
|
||||||
.offset = attribute.offset,
|
.offset = attribute.offset,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
vk::StructureChain<vk::PipelineVertexInputStateCreateInfo, vk::PipelineVertexInputDivisorStateCreateInfoEXT> vertexInputState{
|
vk::StructureChain<vk::PipelineVertexInputStateCreateInfo, vk::PipelineVertexInputDivisorStateCreateInfoEXT> vertexInputState{
|
||||||
@ -668,7 +670,7 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
size_t primaryCbufOffset{desc.cbuf_offset + elemOffset};
|
size_t primaryCbufOffset{desc.cbuf_offset + elemOffset};
|
||||||
u32 primaryVal{primaryCbuf.Read<u32>(ctx.executor, primaryCbufOffset)};
|
u32 primaryVal{primaryCbuf.Read<u32>(ctx.executor, primaryCbufOffset)};
|
||||||
|
|
||||||
if constexpr (requires { desc.has_secondary; } ) {
|
if constexpr (requires { desc.has_secondary; }) {
|
||||||
if (desc.has_secondary) {
|
if (desc.has_secondary) {
|
||||||
ConstantBuffer &secondaryCbuf{constantBuffers[desc.secondary_cbuf_index]};
|
ConstantBuffer &secondaryCbuf{constantBuffers[desc.secondary_cbuf_index]};
|
||||||
size_t secondaryCbufOffset{desc.secondary_cbuf_offset + elemOffset};
|
size_t secondaryCbufOffset{desc.secondary_cbuf_offset + elemOffset};
|
||||||
@ -677,7 +679,7 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return { .raw = primaryVal };
|
return {.raw = primaryVal};
|
||||||
}
|
}
|
||||||
|
|
||||||
static vk::DescriptorImageInfo GetTextureBinding(InterconnectContext &ctx, const Shader::TextureDescriptor &desc, Samplers &samplers, Textures &textures, BindlessHandle handle) {
|
static vk::DescriptorImageInfo GetTextureBinding(InterconnectContext &ctx, const Shader::TextureDescriptor &desc, Samplers &samplers, Textures &textures, BindlessHandle handle) {
|
||||||
@ -768,29 +770,29 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
|
|
||||||
writeBufferDescs(vk::DescriptorType::eUniformBuffer, stage.info.constant_buffer_descriptors, stageDescInfo.uniformBufferDescCount,
|
writeBufferDescs(vk::DescriptorType::eUniformBuffer, stage.info.constant_buffer_descriptors, stageDescInfo.uniformBufferDescCount,
|
||||||
[&](const Shader::ConstantBufferDescriptor &desc, size_t arrayIdx) {
|
[&](const Shader::ConstantBufferDescriptor &desc, size_t arrayIdx) {
|
||||||
size_t cbufIdx{desc.index + arrayIdx};
|
size_t cbufIdx{desc.index + arrayIdx};
|
||||||
return GetConstantBufferBinding(ctx, stage.info, constantBuffers[i][cbufIdx].view, cbufIdx);
|
return GetConstantBufferBinding(ctx, stage.info, constantBuffers[i][cbufIdx].view, cbufIdx);
|
||||||
});
|
});
|
||||||
|
|
||||||
writeBufferDescs(vk::DescriptorType::eStorageBuffer, stage.info.storage_buffers_descriptors, stageDescInfo.storageBufferDescCount,
|
writeBufferDescs(vk::DescriptorType::eStorageBuffer, stage.info.storage_buffers_descriptors, stageDescInfo.storageBufferDescCount,
|
||||||
[&](const Shader::StorageBufferDescriptor &desc, size_t arrayIdx) {
|
[&](const Shader::StorageBufferDescriptor &desc, size_t arrayIdx) {
|
||||||
auto binding{GetStorageBufferBinding(ctx, desc, constantBuffers[i][desc.cbuf_index], storageBufferViews[storageBufferIdx - arrayIdx ? 1 : 0])};
|
auto binding{GetStorageBufferBinding(ctx, desc, constantBuffers[i][desc.cbuf_index], storageBufferViews[storageBufferIdx - arrayIdx ? 1 : 0])};
|
||||||
// Storage buffer arrays all share the same view index, so to only increment the index once per array do it at element zero and subtract that for all subsequent array elems (see above)
|
// Storage buffer arrays all share the same view index, so to only increment the index once per array do it at element zero and subtract that for all subsequent array elems (see above)
|
||||||
storageBufferIdx += arrayIdx ? 0 : 1;
|
storageBufferIdx += arrayIdx ? 0 : 1;
|
||||||
return binding;
|
return binding;
|
||||||
});
|
});
|
||||||
|
|
||||||
writeImageDescs(vk::DescriptorType::eCombinedImageSampler, stage.info.texture_descriptors, stageDescInfo.combinedImageSamplerDescCount,
|
writeImageDescs(vk::DescriptorType::eCombinedImageSampler, stage.info.texture_descriptors, stageDescInfo.combinedImageSamplerDescCount,
|
||||||
[&](const Shader::TextureDescriptor &desc, size_t arrayIdx) {
|
[&](const Shader::TextureDescriptor &desc, size_t arrayIdx) {
|
||||||
BindlessHandle handle{ReadBindlessHandle(ctx, constantBuffers[i], desc, arrayIdx)};
|
BindlessHandle handle{ReadBindlessHandle(ctx, constantBuffers[i], desc, arrayIdx)};
|
||||||
return GetTextureBinding(ctx, desc, samplers, textures, handle);
|
return GetTextureBinding(ctx, desc, samplers, textures, handle);
|
||||||
}, ctx.gpu.traits.quirks.needsIndividualTextureBindingWrites);
|
}, ctx.gpu.traits.quirks.needsIndividualTextureBindingWrites);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Since we don't implement all descriptor types the number of writes might not match what's expected
|
// Since we don't implement all descriptor types the number of writes might not match what's expected
|
||||||
if (!writeIdx)
|
if (!writeIdx)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
return ctx.executor.allocator->EmplaceUntracked<DescriptorUpdateInfo>(DescriptorUpdateInfo{
|
return ctx.executor.allocator->EmplaceUntracked<DescriptorUpdateInfo>(DescriptorUpdateInfo{
|
||||||
.writes = writes.first(writeIdx),
|
.writes = writes.first(writeIdx),
|
||||||
.bufferDescs = bufferDescs.first(bufferIdx),
|
.bufferDescs = bufferDescs.first(bufferIdx),
|
||||||
@ -855,21 +857,21 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
}};
|
}};
|
||||||
|
|
||||||
writeDescs.operator()<false, true>(vk::DescriptorType::eUniformBuffer, cbufUsageInfo.uniformBuffers, shaderInfo.constant_buffer_descriptors,
|
writeDescs.operator()<false, true>(vk::DescriptorType::eUniformBuffer, cbufUsageInfo.uniformBuffers, shaderInfo.constant_buffer_descriptors,
|
||||||
[&](auto usage, const Shader::ConstantBufferDescriptor &desc, size_t arrayIdx) -> DynamicBufferBinding {
|
[&](auto usage, const Shader::ConstantBufferDescriptor &desc, size_t arrayIdx) -> DynamicBufferBinding {
|
||||||
size_t cbufIdx{desc.index + arrayIdx};
|
size_t cbufIdx{desc.index + arrayIdx};
|
||||||
return GetConstantBufferBinding(ctx, shaderInfo, stageConstantBuffers[cbufIdx].view, cbufIdx);
|
return GetConstantBufferBinding(ctx, shaderInfo, stageConstantBuffers[cbufIdx].view, cbufIdx);
|
||||||
});
|
});
|
||||||
|
|
||||||
writeDescs.operator()<false, true>(vk::DescriptorType::eStorageBuffer, cbufUsageInfo.storageBuffers, shaderInfo.storage_buffers_descriptors,
|
writeDescs.operator()<false, true>(vk::DescriptorType::eStorageBuffer, cbufUsageInfo.storageBuffers, shaderInfo.storage_buffers_descriptors,
|
||||||
[&](auto usage, const Shader::StorageBufferDescriptor &desc, size_t arrayIdx) {
|
[&](auto usage, const Shader::StorageBufferDescriptor &desc, size_t arrayIdx) {
|
||||||
return GetStorageBufferBinding(ctx, desc, stageConstantBuffers[desc.cbuf_index], storageBufferViews[usage.storageBufferIdx]);
|
return GetStorageBufferBinding(ctx, desc, stageConstantBuffers[desc.cbuf_index], storageBufferViews[usage.storageBufferIdx]);
|
||||||
});
|
});
|
||||||
|
|
||||||
writeDescs.operator()<true, false>(vk::DescriptorType::eCombinedImageSampler, cbufUsageInfo.combinedImageSamplers, shaderInfo.texture_descriptors,
|
writeDescs.operator()<true, false>(vk::DescriptorType::eCombinedImageSampler, cbufUsageInfo.combinedImageSamplers, shaderInfo.texture_descriptors,
|
||||||
[&](auto usage, const Shader::TextureDescriptor &desc, size_t arrayIdx) {
|
[&](auto usage, const Shader::TextureDescriptor &desc, size_t arrayIdx) {
|
||||||
BindlessHandle handle{ReadBindlessHandle(ctx, stageConstantBuffers, desc, arrayIdx)};
|
BindlessHandle handle{ReadBindlessHandle(ctx, stageConstantBuffers, desc, arrayIdx)};
|
||||||
return GetTextureBinding(ctx, desc, samplers, textures, handle);
|
return GetTextureBinding(ctx, desc, samplers, textures, handle);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Since we don't implement all descriptor types the number of writes might not match what's expected
|
// Since we don't implement all descriptor types the number of writes might not match what's expected
|
||||||
if (!writeIdx)
|
if (!writeIdx)
|
||||||
|
@ -34,11 +34,11 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
*/
|
*/
|
||||||
bool BindingsEqual(const ShaderStage &other) const {
|
bool BindingsEqual(const ShaderStage &other) const {
|
||||||
return info.constant_buffer_descriptors == other.info.constant_buffer_descriptors &&
|
return info.constant_buffer_descriptors == other.info.constant_buffer_descriptors &&
|
||||||
info.storage_buffers_descriptors == other.info.storage_buffers_descriptors &&
|
info.storage_buffers_descriptors == other.info.storage_buffers_descriptors &&
|
||||||
info.texture_buffer_descriptors == other.info.texture_buffer_descriptors &&
|
info.texture_buffer_descriptors == other.info.texture_buffer_descriptors &&
|
||||||
info.image_buffer_descriptors == other.info.image_buffer_descriptors &&
|
info.image_buffer_descriptors == other.info.image_buffer_descriptors &&
|
||||||
info.texture_descriptors == other.info.texture_descriptors &&
|
info.texture_descriptors == other.info.texture_descriptors &&
|
||||||
info.image_descriptors == other.info.image_descriptors;
|
info.image_descriptors == other.info.image_descriptors;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -207,5 +207,4 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
return sampler.get();
|
return sampler.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -39,7 +39,6 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
tsl::robin_map<TextureSamplerControl, std::unique_ptr<vk::raii::Sampler>, util::ObjectHash<TextureSamplerControl>> texSamplerStore;
|
tsl::robin_map<TextureSamplerControl, std::unique_ptr<vk::raii::Sampler>, util::ObjectHash<TextureSamplerControl>> texSamplerStore;
|
||||||
std::vector<vk::raii::Sampler *> texSamplerCache;
|
std::vector<vk::raii::Sampler *> texSamplerCache;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Samplers(DirtyManager &manager, const SamplerPoolState::EngineRegisters &engine);
|
Samplers(DirtyManager &manager, const SamplerPoolState::EngineRegisters &engine);
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
Cmd cmd;
|
Cmd cmd;
|
||||||
|
|
||||||
CmdHolder(Cmd &&cmd) : cmd{cmd} {}
|
CmdHolder(Cmd &&cmd) : cmd{cmd} {}
|
||||||
|
|
||||||
CmdHolder() = default;
|
CmdHolder() = default;
|
||||||
|
|
||||||
static void Record(GPU &gpu, vk::raii::CommandBuffer &commandBuffer, StateUpdateCmdHeader *header) {
|
static void Record(GPU &gpu, vk::raii::CommandBuffer &commandBuffer, StateUpdateCmdHeader *header) {
|
||||||
@ -55,7 +55,7 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
base.buffers[i] = views[i].GetBuffer()->GetBacking();
|
base.buffers[i] = views[i].GetBuffer()->GetBacking();
|
||||||
base.offsets[i] = views[i].GetOffset();
|
base.offsets[i] = views[i].GetOffset();
|
||||||
}
|
}
|
||||||
|
|
||||||
base.Record(gpu, commandBuffer);
|
base.Record(gpu, commandBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
void Record(GPU &gpu, vk::raii::CommandBuffer &commandBuffer) {
|
void Record(GPU &gpu, vk::raii::CommandBuffer &commandBuffer) {
|
||||||
commandBuffer.bindIndexBuffer(buffer, offset, indexType);
|
commandBuffer.bindIndexBuffer(buffer, offset, indexType);
|
||||||
}
|
}
|
||||||
|
|
||||||
vk::Buffer buffer;
|
vk::Buffer buffer;
|
||||||
vk::DeviceSize offset;
|
vk::DeviceSize offset;
|
||||||
vk::IndexType indexType;
|
vk::IndexType indexType;
|
||||||
@ -81,7 +81,7 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
base.offset = view.GetOffset();
|
base.offset = view.GetOffset();
|
||||||
base.Record(gpu, commandBuffer);
|
base.Record(gpu, commandBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
SetIndexBufferCmdImpl base;
|
SetIndexBufferCmdImpl base;
|
||||||
BufferView view;
|
BufferView view;
|
||||||
};
|
};
|
||||||
@ -91,7 +91,7 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
void Record(GPU &gpu, vk::raii::CommandBuffer &commandBuffer) {
|
void Record(GPU &gpu, vk::raii::CommandBuffer &commandBuffer) {
|
||||||
commandBuffer.bindTransformFeedbackBuffersEXT(binding, buffer, offset, size);
|
commandBuffer.bindTransformFeedbackBuffersEXT(binding, buffer, offset, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 binding;
|
u32 binding;
|
||||||
vk::Buffer buffer;
|
vk::Buffer buffer;
|
||||||
vk::DeviceSize offset;
|
vk::DeviceSize offset;
|
||||||
@ -105,7 +105,7 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
base.offset = view.GetOffset();
|
base.offset = view.GetOffset();
|
||||||
base.Record(gpu, commandBuffer);
|
base.Record(gpu, commandBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
SetTransformFeedbackBufferCmdImpl base;
|
SetTransformFeedbackBufferCmdImpl base;
|
||||||
BufferView view;
|
BufferView view;
|
||||||
};
|
};
|
||||||
@ -115,7 +115,7 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
void Record(GPU &gpu, vk::raii::CommandBuffer &commandBuffer) {
|
void Record(GPU &gpu, vk::raii::CommandBuffer &commandBuffer) {
|
||||||
commandBuffer.setViewport(index, viewport);
|
commandBuffer.setViewport(index, viewport);
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 index;
|
u32 index;
|
||||||
vk::Viewport viewport;
|
vk::Viewport viewport;
|
||||||
};
|
};
|
||||||
@ -125,17 +125,17 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
void Record(GPU &gpu, vk::raii::CommandBuffer &commandBuffer) {
|
void Record(GPU &gpu, vk::raii::CommandBuffer &commandBuffer) {
|
||||||
commandBuffer.setScissor(index, scissor);
|
commandBuffer.setScissor(index, scissor);
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 index;
|
u32 index;
|
||||||
vk::Rect2D scissor;
|
vk::Rect2D scissor;
|
||||||
};
|
};
|
||||||
using SetScissorCmd = CmdHolder<SetScissorCmdImpl>;
|
using SetScissorCmd = CmdHolder<SetScissorCmdImpl>;
|
||||||
|
|
||||||
struct SetLineWidthCmdImpl {
|
struct SetLineWidthCmdImpl {
|
||||||
void Record(GPU &gpu, vk::raii::CommandBuffer &commandBuffer) {
|
void Record(GPU &gpu, vk::raii::CommandBuffer &commandBuffer) {
|
||||||
commandBuffer.setLineWidth(lineWidth);
|
commandBuffer.setLineWidth(lineWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
float lineWidth;
|
float lineWidth;
|
||||||
};
|
};
|
||||||
using SetLineWidthCmd = CmdHolder<SetLineWidthCmdImpl>;
|
using SetLineWidthCmd = CmdHolder<SetLineWidthCmdImpl>;
|
||||||
@ -144,7 +144,7 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
void Record(GPU &gpu, vk::raii::CommandBuffer &commandBuffer) {
|
void Record(GPU &gpu, vk::raii::CommandBuffer &commandBuffer) {
|
||||||
commandBuffer.setDepthBias(depthBiasConstantFactor, depthBiasClamp, depthBiasSlopeFactor);
|
commandBuffer.setDepthBias(depthBiasConstantFactor, depthBiasClamp, depthBiasSlopeFactor);
|
||||||
}
|
}
|
||||||
|
|
||||||
float depthBiasConstantFactor;
|
float depthBiasConstantFactor;
|
||||||
float depthBiasClamp;
|
float depthBiasClamp;
|
||||||
float depthBiasSlopeFactor;
|
float depthBiasSlopeFactor;
|
||||||
@ -155,7 +155,7 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
void Record(GPU &gpu, vk::raii::CommandBuffer &commandBuffer) {
|
void Record(GPU &gpu, vk::raii::CommandBuffer &commandBuffer) {
|
||||||
commandBuffer.setBlendConstants(blendConstants.data());
|
commandBuffer.setBlendConstants(blendConstants.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::array<float, 4> blendConstants;
|
std::array<float, 4> blendConstants;
|
||||||
};
|
};
|
||||||
using SetBlendConstantsCmd = CmdHolder<SetBlendConstantsCmdImpl>;
|
using SetBlendConstantsCmd = CmdHolder<SetBlendConstantsCmdImpl>;
|
||||||
@ -164,7 +164,7 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
void Record(GPU &gpu, vk::raii::CommandBuffer &commandBuffer) {
|
void Record(GPU &gpu, vk::raii::CommandBuffer &commandBuffer) {
|
||||||
commandBuffer.setDepthBounds(minDepthBounds, maxDepthBounds);
|
commandBuffer.setDepthBounds(minDepthBounds, maxDepthBounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
float minDepthBounds;
|
float minDepthBounds;
|
||||||
float maxDepthBounds;
|
float maxDepthBounds;
|
||||||
};
|
};
|
||||||
@ -176,7 +176,7 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
commandBuffer.setStencilReference(flags, funcRef);
|
commandBuffer.setStencilReference(flags, funcRef);
|
||||||
commandBuffer.setStencilWriteMask(flags, mask);
|
commandBuffer.setStencilWriteMask(flags, mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
vk::StencilFaceFlags flags;
|
vk::StencilFaceFlags flags;
|
||||||
u32 funcRef;
|
u32 funcRef;
|
||||||
u32 funcMask;
|
u32 funcMask;
|
||||||
@ -184,7 +184,8 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
};
|
};
|
||||||
using SetBaseStencilStateCmd = CmdHolder<SetBaseStencilStateCmdImpl>;
|
using SetBaseStencilStateCmd = CmdHolder<SetBaseStencilStateCmdImpl>;
|
||||||
|
|
||||||
struct SetDescriptorSetWithUpdateCmdImpl {
|
template<bool PushDescriptor>
|
||||||
|
struct SetDescriptorSetCmdImpl {
|
||||||
void Record(GPU &gpu, vk::raii::CommandBuffer &commandBuffer) {
|
void Record(GPU &gpu, vk::raii::CommandBuffer &commandBuffer) {
|
||||||
// Resolve descriptor infos from dynamic bindings
|
// Resolve descriptor infos from dynamic bindings
|
||||||
for (size_t i{}; i < updateInfo->bufferDescDynamicBindings.size(); i++) {
|
for (size_t i{}; i < updateInfo->bufferDescDynamicBindings.size(); i++) {
|
||||||
@ -245,7 +246,7 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
class StateUpdater {
|
class StateUpdater {
|
||||||
private:
|
private:
|
||||||
StateUpdateCmdHeader *first;
|
StateUpdateCmdHeader *first;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
StateUpdater(StateUpdateCmdHeader *first) : first{first} {}
|
StateUpdater(StateUpdateCmdHeader *first) : first{first} {}
|
||||||
|
|
||||||
@ -268,7 +269,7 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
SetVertexBuffersDynamicCmd *vertexBatchBind{};
|
SetVertexBuffersDynamicCmd *vertexBatchBind{};
|
||||||
StateUpdateCmdHeader *head{};
|
StateUpdateCmdHeader *head{};
|
||||||
StateUpdateCmdHeader *tail{};
|
StateUpdateCmdHeader *tail{};
|
||||||
|
|
||||||
void AppendCmd(StateUpdateCmdHeader *cmd) {
|
void AppendCmd(StateUpdateCmdHeader *cmd) {
|
||||||
if (tail) {
|
if (tail) {
|
||||||
tail->next = cmd;
|
tail->next = cmd;
|
||||||
@ -278,7 +279,7 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
tail = head;
|
tail = head;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Cmd>
|
template<typename Cmd>
|
||||||
void AppendCmd(typename Cmd::CmdType &&contents) {
|
void AppendCmd(typename Cmd::CmdType &&contents) {
|
||||||
Cmd *cmd{allocator.template EmplaceUntracked<Cmd>(std::forward<typename Cmd::CmdType>(contents))};
|
Cmd *cmd{allocator.template EmplaceUntracked<Cmd>(std::forward<typename Cmd::CmdType>(contents))};
|
||||||
@ -332,101 +333,121 @@ namespace skyline::gpu::interconnect::maxwell3d {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SetIndexBuffer(const BufferBinding &binding, vk::IndexType indexType) {
|
void SetIndexBuffer(const BufferBinding &binding, vk::IndexType indexType) {
|
||||||
AppendCmd<SetIndexBufferCmd>({
|
AppendCmd<SetIndexBufferCmd>(
|
||||||
.indexType = indexType,
|
{
|
||||||
.buffer = binding.buffer,
|
.indexType = indexType,
|
||||||
.offset = binding.offset,
|
.buffer = binding.buffer,
|
||||||
});
|
.offset = binding.offset,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetIndexBuffer(BufferView view, vk::IndexType indexType) {
|
void SetIndexBuffer(BufferView view, vk::IndexType indexType) {
|
||||||
view.GetBuffer()->BlockSequencedCpuBackingWrites();
|
view.GetBuffer()->BlockSequencedCpuBackingWrites();
|
||||||
|
|
||||||
AppendCmd<SetIndexBufferDynamicCmd>({
|
AppendCmd<SetIndexBufferDynamicCmd>(
|
||||||
.base.indexType = indexType,
|
{
|
||||||
.view = view,
|
.base.indexType = indexType,
|
||||||
});
|
.view = view,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetTransformFeedbackBuffer(u32 index, const BufferBinding &binding) {
|
void SetTransformFeedbackBuffer(u32 index, const BufferBinding &binding) {
|
||||||
AppendCmd<SetTransformFeedbackBufferCmd>({
|
AppendCmd<SetTransformFeedbackBufferCmd>(
|
||||||
.binding = index,
|
{
|
||||||
.buffer = binding.buffer,
|
.binding = index,
|
||||||
.offset = binding.offset,
|
.buffer = binding.buffer,
|
||||||
});
|
.offset = binding.offset,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetTransformFeedbackBuffer(u32 index, BufferView view) {
|
void SetTransformFeedbackBuffer(u32 index, BufferView view) {
|
||||||
view.GetBuffer()->BlockSequencedCpuBackingWrites();
|
view.GetBuffer()->BlockSequencedCpuBackingWrites();
|
||||||
|
|
||||||
AppendCmd<SetTransformFeedbackBufferDynamicCmd>({
|
AppendCmd<SetTransformFeedbackBufferDynamicCmd>(
|
||||||
.base.binding = index,
|
{
|
||||||
.view = view,
|
.base.binding = index,
|
||||||
});
|
.view = view,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetViewport(u32 index, const vk::Viewport &viewport) {
|
void SetViewport(u32 index, const vk::Viewport &viewport) {
|
||||||
AppendCmd<SetViewportCmd>({
|
AppendCmd<SetViewportCmd>(
|
||||||
.index = index,
|
{
|
||||||
.viewport = viewport,
|
.index = index,
|
||||||
});
|
.viewport = viewport,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetScissor(u32 index, const vk::Rect2D &scissor) {
|
void SetScissor(u32 index, const vk::Rect2D &scissor) {
|
||||||
AppendCmd<SetScissorCmd>({
|
AppendCmd<SetScissorCmd>(
|
||||||
.index = index,
|
{
|
||||||
.scissor = scissor,
|
.index = index,
|
||||||
});
|
.scissor = scissor,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetLineWidth(float lineWidth) {
|
void SetLineWidth(float lineWidth) {
|
||||||
AppendCmd<SetLineWidthCmd>({
|
AppendCmd<SetLineWidthCmd>(
|
||||||
.lineWidth = lineWidth,
|
{
|
||||||
});
|
.lineWidth = lineWidth,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetDepthBias(float depthBiasConstantFactor, float depthBiasClamp, float depthBiasSlopeFactor) {
|
void SetDepthBias(float depthBiasConstantFactor, float depthBiasClamp, float depthBiasSlopeFactor) {
|
||||||
AppendCmd<SetDepthBiasCmd>({
|
AppendCmd<SetDepthBiasCmd>(
|
||||||
.depthBiasConstantFactor = depthBiasConstantFactor,
|
{
|
||||||
.depthBiasClamp = depthBiasClamp,
|
.depthBiasConstantFactor = depthBiasConstantFactor,
|
||||||
.depthBiasSlopeFactor = depthBiasSlopeFactor,
|
.depthBiasClamp = depthBiasClamp,
|
||||||
});
|
.depthBiasSlopeFactor = depthBiasSlopeFactor,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetBlendConstants(const std::array<float, engine::BlendColorChannelCount> &blendConstants) {
|
void SetBlendConstants(const std::array<float, engine::BlendColorChannelCount> &blendConstants) {
|
||||||
AppendCmd<SetBlendConstantsCmd>({
|
AppendCmd<SetBlendConstantsCmd>(
|
||||||
.blendConstants = blendConstants,
|
{
|
||||||
});
|
.blendConstants = blendConstants,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetDepthBounds(float minDepthBounds, float maxDepthBounds) {
|
void SetDepthBounds(float minDepthBounds, float maxDepthBounds) {
|
||||||
AppendCmd<SetDepthBoundsCmd>({
|
AppendCmd<SetDepthBoundsCmd>(
|
||||||
.minDepthBounds = minDepthBounds,
|
{
|
||||||
.maxDepthBounds = maxDepthBounds,
|
.minDepthBounds = minDepthBounds,
|
||||||
});
|
.maxDepthBounds = maxDepthBounds,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetBaseStencilState(vk::StencilFaceFlags flags, u32 funcRef, u32 funcMask, u32 mask) {
|
void SetBaseStencilState(vk::StencilFaceFlags flags, u32 funcRef, u32 funcMask, u32 mask) {
|
||||||
AppendCmd<SetBaseStencilStateCmd>({
|
AppendCmd<SetBaseStencilStateCmd>(
|
||||||
.flags = flags,
|
{
|
||||||
.funcRef = funcRef,
|
.flags = flags,
|
||||||
.funcMask = funcMask,
|
.funcRef = funcRef,
|
||||||
.mask = mask,
|
.funcMask = funcMask,
|
||||||
});
|
.mask = mask,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetDescriptorSetWithUpdate(DescriptorUpdateInfo *updateInfo, DescriptorAllocator::ActiveDescriptorSet *dstSet, DescriptorAllocator::ActiveDescriptorSet *srcSet) {
|
void SetDescriptorSetWithUpdate(DescriptorUpdateInfo *updateInfo, DescriptorAllocator::ActiveDescriptorSet *dstSet, DescriptorAllocator::ActiveDescriptorSet *srcSet) {
|
||||||
AppendCmd<SetDescriptorSetWithUpdateCmd>({
|
AppendCmd<SetDescriptorSetWithUpdateCmd>(
|
||||||
.updateInfo = updateInfo,
|
{
|
||||||
.srcSet = srcSet,
|
.updateInfo = updateInfo,
|
||||||
.dstSet = dstSet,
|
.srcSet = srcSet,
|
||||||
});
|
.dstSet = dstSet,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetPipeline(vk::Pipeline pipeline) {
|
void SetPipeline(vk::Pipeline pipeline) {
|
||||||
AppendCmd<SetPipelineCmd>({
|
AppendCmd<SetPipelineCmd>(
|
||||||
.pipeline = pipeline,
|
{
|
||||||
});
|
.pipeline = pipeline,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetDescriptorSetWithPush(DescriptorUpdateInfo *updateInfo) {
|
||||||
|
AppendCmd<SetDescriptorSetWithPushCmd>(
|
||||||
|
{
|
||||||
|
.updateInfo = updateInfo,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -200,7 +200,6 @@ namespace skyline::gpu::interconnect {
|
|||||||
e16to1 = 7,
|
e16to1 = 7,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// 0x00
|
// 0x00
|
||||||
struct FormatWord {
|
struct FormatWord {
|
||||||
static constexpr u32 FormatColorComponentPadMask{(1U << 31) | 0b111'111'111'111'1111111U}; //!< Mask for the format, component and pad fields
|
static constexpr u32 FormatColorComponentPadMask{(1U << 31) | 0b111'111'111'111'1111111U}; //!< Mask for the format, component and pad fields
|
||||||
|
@ -112,7 +112,7 @@ namespace skyline::gpu::interconnect {
|
|||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool operator==(const TextureSamplerControl&) const = default;
|
bool operator==(const TextureSamplerControl &) const = default;
|
||||||
|
|
||||||
float MaxAnisotropy() {
|
float MaxAnisotropy() {
|
||||||
constexpr size_t AnisotropyCount{8}; //!< The amount of unique anisotropy values that can be represented (2^3 — 3-bit value)
|
constexpr size_t AnisotropyCount{8}; //!< The amount of unique anisotropy values that can be represented (2^3 — 3-bit value)
|
||||||
|
Loading…
Reference in New Issue
Block a user