mirror of
https://github.com/libretro/ppsspp.git
synced 2024-11-30 11:50:32 +00:00
Cleanups. Don't loop over bones in vshader, causes trouble
This commit is contained in:
parent
1677697735
commit
432f276bec
@ -141,10 +141,6 @@ DrawEngineVulkan::DrawEngineVulkan(VulkanContext *vulkan)
|
||||
dp.maxSets = 1000;
|
||||
dp.pPoolSizes = dpTypes;
|
||||
dp.poolSizeCount = ARRAY_SIZE(dpTypes);
|
||||
res = vkCreateDescriptorPool(device, &dp, nullptr, &frame_[0].descPool);
|
||||
assert(VK_SUCCESS == res);
|
||||
res = vkCreateDescriptorPool(device, &dp, nullptr, &frame_[1].descPool);
|
||||
assert(VK_SUCCESS == res);
|
||||
|
||||
// We are going to use one-shot descriptors in the initial implementation. Might look into caching them
|
||||
// if creating and updating them turns out to be expensive.
|
||||
@ -161,6 +157,7 @@ DrawEngineVulkan::DrawEngineVulkan(VulkanContext *vulkan)
|
||||
pl.pushConstantRangeCount = 0;
|
||||
pl.setLayoutCount = 1;
|
||||
pl.pSetLayouts = &descriptorSetLayout_;
|
||||
pl.flags = 0;
|
||||
res = vkCreatePipelineLayout(device, &pl, nullptr, &pipelineLayout_);
|
||||
assert(VK_SUCCESS == res);
|
||||
|
||||
@ -406,7 +403,7 @@ VkDescriptorSet DrawEngineVulkan::GetDescriptorSet(VkImageView imageView, VkSamp
|
||||
assert(result == VK_SUCCESS);
|
||||
|
||||
// We just don't write to the slots we don't care about.
|
||||
VkWriteDescriptorSet writes[2];
|
||||
VkWriteDescriptorSet writes[4];
|
||||
memset(writes, 0, sizeof(writes));
|
||||
// Main texture
|
||||
int n = 0;
|
||||
@ -437,14 +434,16 @@ VkDescriptorSet DrawEngineVulkan::GetDescriptorSet(VkImageView imageView, VkSamp
|
||||
buf[2].buffer = dynamicUbo;
|
||||
buf[2].offset = 0;
|
||||
buf[2].range = sizeof(UB_VS_Bones);
|
||||
for (int i = 0; i < 3; i++) {
|
||||
writes[n].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
|
||||
writes[n].pNext = nullptr;
|
||||
writes[n].dstBinding = DRAW_BINDING_DYNUBO_BASE;
|
||||
writes[n].pBufferInfo = &buf[0];
|
||||
writes[n].dstBinding = DRAW_BINDING_DYNUBO_BASE + i;
|
||||
writes[n].pBufferInfo = &buf[i];
|
||||
writes[n].dstSet = desc;
|
||||
writes[n].descriptorCount = 3;
|
||||
writes[n].descriptorCount = 1;
|
||||
writes[n].descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC;
|
||||
n++;
|
||||
}
|
||||
|
||||
vkUpdateDescriptorSets(vulkan_->GetDevice(), n, writes, 0, nullptr);
|
||||
|
||||
@ -550,7 +549,8 @@ void DrawEngineVulkan::DoFlush(VkCommandBuffer cmd) {
|
||||
};
|
||||
vkCmdBindDescriptorSets(cmd_, VK_PIPELINE_BIND_POINT_GRAPHICS, pipelineLayout_, 0, 1, &ds, 3, dynamicUBOOffsets);
|
||||
|
||||
vbOffset = (uint32_t)frame->pushData->PushAligned(decoded, vertexCount * dec_->GetDecVtxFmt().stride, 16);
|
||||
int stride = dec_->GetDecVtxFmt().stride;
|
||||
vbOffset = (uint32_t)frame->pushData->PushAligned(decoded, vertexCount * stride, 16);
|
||||
|
||||
VkDeviceSize offsets[1] = { vbOffset };
|
||||
if (useElements) {
|
||||
|
@ -1,6 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#define VK_PROTOTYPES
|
||||
#include "ext/vulkan/vulkan.h"
|
||||
|
||||
#include <cstring>
|
||||
|
@ -269,24 +269,11 @@ bool GenerateVulkanGLSLVertexShader(const ShaderID &id, char *buffer) {
|
||||
"w2.x", "w2.y", "w2.z", "w2.w",
|
||||
};
|
||||
|
||||
// To loop through the weights, we unfortunately need to put them in a float array.
|
||||
// GLSL ES sucks - no way to directly initialize an array!
|
||||
switch (numBoneWeights) {
|
||||
case 1: WRITE(p, " float w[1]; w[0] = w1;\n"); break;
|
||||
case 2: WRITE(p, " float w[2]; w[0] = w1.x; w[1] = w1.y;\n"); break;
|
||||
case 3: WRITE(p, " float w[3]; w[0] = w1.x; w[1] = w1.y; w[2] = w1.z;\n"); break;
|
||||
case 4: WRITE(p, " float w[4]; w[0] = w1.x; w[1] = w1.y; w[2] = w1.z; w[3] = w1.w;\n"); break;
|
||||
case 5: WRITE(p, " float w[5]; w[0] = w1.x; w[1] = w1.y; w[2] = w1.z; w[3] = w1.w; w[4] = w2;\n"); break;
|
||||
case 6: WRITE(p, " float w[6]; w[0] = w1.x; w[1] = w1.y; w[2] = w1.z; w[3] = w1.w; w[4] = w2.x; w[5] = w2.y;\n"); break;
|
||||
case 7: WRITE(p, " float w[7]; w[0] = w1.x; w[1] = w1.y; w[2] = w1.z; w[3] = w1.w; w[4] = w2.x; w[5] = w2.y; w[6] = w2.z;\n"); break;
|
||||
case 8: WRITE(p, " float w[8]; w[0] = w1.x; w[1] = w1.y; w[2] = w1.z; w[3] = w1.w; w[4] = w2.x; w[5] = w2.y; w[6] = w2.z; w[7] = w2.w;\n"); break;
|
||||
}
|
||||
|
||||
WRITE(p, " mat4 skinMatrix = w[0] * bone.m[0];\n");
|
||||
WRITE(p, " mat4 skinMatrix = w1.x * bone.m[0];\n");
|
||||
if (numBoneWeights > 1) {
|
||||
WRITE(p, " for (int i = 1; i < %i; i++) {\n", numBoneWeights);
|
||||
WRITE(p, " skinMatrix += w[i] * bone.m[i];\n");
|
||||
WRITE(p, " }\n");
|
||||
for (int i = 1; i < numBoneWeights; i++) {
|
||||
WRITE(p, " skinMatrix += %s * bone.m[%i];\n", boneWeightAttr[i], i);
|
||||
}
|
||||
}
|
||||
|
||||
WRITE(p, ";\n");
|
||||
|
@ -1,5 +1,4 @@
|
||||
#pragma once
|
||||
|
||||
#define VK_PROTOTYPES
|
||||
#include "ext/vulkan/vulkan.h"
|
||||
|
||||
|
@ -722,7 +722,9 @@ void NativeRender(GraphicsContext *graphicsContext) {
|
||||
screenManager->getUIContext()->Text()->OncePerFrame();
|
||||
}
|
||||
|
||||
DrawDownloadsOverlay(*screenManager->getUIContext());
|
||||
// At this point, the vulkan context has been "ended" already, no more drawing can be done in this frame.
|
||||
// TODO: Integrate the download overlay with the screen system
|
||||
// DrawDownloadsOverlay(*screenManager->getUIContext());
|
||||
|
||||
if (g_TakeScreenshot) {
|
||||
TakeScreenshot();
|
||||
|
@ -474,7 +474,7 @@ public:
|
||||
size_t out = offset_;
|
||||
offset_ += (numBytes + 3) & ~3; // Round up to 4 bytes.
|
||||
if (offset_ >= size_) {
|
||||
// For now. 4MB is not enough for God of War but lets start with smaller games :P
|
||||
// TODO: Allocate a second buffer, then combine them on the next frame.
|
||||
#ifdef _WIN32
|
||||
DebugBreak();
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user