mirror of
https://github.com/izzy2lost/ppsspp.git
synced 2026-03-10 12:43:04 -07:00
[spline/bezier]Split SendDataToShader() into two functions.
This commit is contained in:
@@ -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
Submodule ffmpeg updated: a2e98d7ba4...0757f14d86
Reference in New Issue
Block a user