mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
[spline/bezier]Split SendDataToShader() into two functions.
This commit is contained in:
parent
b5d4f202a3
commit
f14b75492d
5 changed files with 19 additions and 11 deletions
|
@ -111,6 +111,7 @@ protected:
|
|||
virtual ~TessellationDataTransfer() {}
|
||||
// Send spline/bezier's control points to vertex shader through floating point texture.
|
||||
virtual void SendDataToShader(const float *pos, const float *tex, const float *col, int size, bool hasColor, bool hasTexCoords) = 0;
|
||||
virtual void PrepareBuffers(float *&pos, float *&tex, float *&col, int size, bool hasColor, bool hasTexCoords) {};
|
||||
};
|
||||
TessellationDataTransfer *tessDataTransfer;
|
||||
};
|
||||
|
|
|
@ -1019,6 +1019,7 @@ void DrawEngineCommon::SubmitBezier(const void *control_points, const void *indi
|
|||
int num_patches_v = (count_v - 1) / 3;
|
||||
BezierPatch *patches = nullptr;
|
||||
if (g_Config.bHardwareTessellation && g_Config.bHardwareTransform && !g_Config.bSoftwareRendering) {
|
||||
tessDataTransfer->PrepareBuffers(pos, tex, col, count_u * count_v, hasColor, hasTexCoords);
|
||||
for (int idx = 0; idx < count_u * count_v; idx++) {
|
||||
SimpleVertex *point = simplified_control_points + (indices ? idxConv.convert(idx) : idx);
|
||||
memcpy(pos + idx * 3, point->pos.AsArray(), 3 * sizeof(float));
|
||||
|
|
|
@ -937,9 +937,8 @@ bool DrawEngineVulkan::IsCodePtrVertexDecoder(const u8 *ptr) const {
|
|||
return decJitCache_->IsInSpace(ptr);
|
||||
}
|
||||
|
||||
void DrawEngineVulkan::TessellationDataTransferVulkan::SendDataToShader(const float * pos, const float * tex, const float * col, int size, bool hasColor, bool hasTexCoords) {
|
||||
void DrawEngineVulkan::TessellationDataTransferVulkan::PrepareBuffers(float *&pos, float *&tex, float *&col, int size, bool hasColor, bool hasTexCoords) {
|
||||
int rowPitch;
|
||||
u8 *data;
|
||||
|
||||
// Position
|
||||
if (prevSize < size) {
|
||||
|
@ -947,9 +946,7 @@ void DrawEngineVulkan::TessellationDataTransferVulkan::SendDataToShader(const fl
|
|||
|
||||
data_tex[0]->CreateDirect(size, 1, 1, VK_FORMAT_R32G32B32_SFLOAT, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL);
|
||||
}
|
||||
data = data_tex[0]->Lock(0, &rowPitch);
|
||||
memcpy(data, pos, size * 3 * sizeof(float));
|
||||
data_tex[0]->Unlock();
|
||||
pos = (float *)data_tex[0]->Lock(0, &rowPitch);
|
||||
|
||||
// Texcoords
|
||||
if (hasTexCoords) {
|
||||
|
@ -958,9 +955,7 @@ void DrawEngineVulkan::TessellationDataTransferVulkan::SendDataToShader(const fl
|
|||
|
||||
data_tex[1]->CreateDirect(size, 1, 1, VK_FORMAT_R32G32B32_SFLOAT, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL);
|
||||
}
|
||||
data = data_tex[1]->Lock(0, &rowPitch);
|
||||
memcpy(data, tex, size * 3 * sizeof(float));
|
||||
data_tex[1]->Unlock();
|
||||
tex = (float *)data_tex[1]->Lock(0, &rowPitch);
|
||||
}
|
||||
|
||||
// Color
|
||||
|
@ -970,7 +965,17 @@ void DrawEngineVulkan::TessellationDataTransferVulkan::SendDataToShader(const fl
|
|||
|
||||
data_tex[2]->CreateDirect(sizeColor, 1, 1, VK_FORMAT_R32G32B32A32_SFLOAT, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL);
|
||||
}
|
||||
data = data_tex[2]->Lock(0, &rowPitch);
|
||||
memcpy(data, col, sizeColor * 4 * sizeof(float));
|
||||
col = (float *)data_tex[2]->Lock(0, &rowPitch);
|
||||
}
|
||||
|
||||
void DrawEngineVulkan::TessellationDataTransferVulkan::SendDataToShader(const float *pos, const float *tex, const float *col, int size, bool hasColor, bool hasTexCoords) {
|
||||
// Position
|
||||
data_tex[0]->Unlock();
|
||||
|
||||
// Texcoords
|
||||
if (hasTexCoords)
|
||||
data_tex[1]->Unlock();
|
||||
|
||||
// Color
|
||||
data_tex[2]->Unlock();
|
||||
}
|
||||
|
|
|
@ -262,6 +262,7 @@ private:
|
|||
vulkan->Delete().QueueDeleteSampler(sampler);
|
||||
}
|
||||
void SendDataToShader(const float *pos, const float *tex, const float *col, int size, bool hasColor, bool hasTexCoords) override;
|
||||
void PrepareBuffers(float *&pos, float *&tex, float *&col, int size, bool hasColor, bool hasTexCoords) override;
|
||||
VulkanTexture *GetTexture(int i) const { return data_tex[i]; }
|
||||
VkSampler GetSampler() const { return sampler; }
|
||||
void CreateSampler() {
|
||||
|
|
2
ffmpeg
2
ffmpeg
|
@ -1 +1 @@
|
|||
Subproject commit a2e98d7ba4c7c5cac08608732c3058cb46e3e0ef
|
||||
Subproject commit 0757f14d86f1574c02d7f7b9b1c7cd10aad79f75
|
Loading…
Add table
Reference in a new issue