mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
[spline/bezier]Change all backends vertex texture format to RGBA(16 bytes).
This commit is contained in:
parent
f4737cc1fa
commit
ca7f265b11
2 changed files with 22 additions and 24 deletions
|
@ -926,19 +926,18 @@ void DrawEngineCommon::SubmitSpline(const void *control_points, const void *indi
|
|||
patch.patchFacing = patchFacing;
|
||||
|
||||
if (g_Config.bHardwareTessellation && g_Config.bHardwareTransform && !g_Config.bSoftwareRendering) {
|
||||
int stride = g_Config.iGPUBackend == GPU_BACKEND_VULKAN || g_Config.iGPUBackend == GPU_BACKEND_DIRECT3D11 ? 4 : 3;
|
||||
float *pos = (float*)(decoded + 65536 * 18); // Size 3 float (4 for Vulkan and D3D11)
|
||||
float *tex = pos + count_u * count_v * stride; // Size 3 float (4 for Vulkan and D3D11)
|
||||
float *col = tex + count_u * count_v * stride; // Size 4 float
|
||||
|
||||
float *pos = (float*)(decoded + 65536 * 18); // Size 4 float
|
||||
float *tex = pos + count_u * count_v * 4; // Size 4 float
|
||||
float *col = tex + count_u * count_v * 4; // Size 4 float
|
||||
const bool hasColor = (origVertType & GE_VTYPE_COL_MASK) != 0;
|
||||
const bool hasTexCoords = (origVertType & GE_VTYPE_TC_MASK) != 0;
|
||||
|
||||
if (g_Config.iGPUBackend == GPU_BACKEND_VULKAN)
|
||||
tessDataTransfer->PrepareBuffers(pos, tex, col, count_u * count_v, hasColor, hasTexCoords);
|
||||
tessDataTransfer->PrepareBuffers(pos, tex, col, count_u * count_v, hasColor, hasTexCoords);
|
||||
for (int idx = 0; idx < count_u * count_v; idx++) {
|
||||
memcpy(pos + idx * stride, points[idx]->pos.AsArray(), 3 * sizeof(float));
|
||||
memcpy(pos + idx * 4, points[idx]->pos.AsArray(), 3 * sizeof(float));
|
||||
if (hasTexCoords)
|
||||
memcpy(tex + idx * stride, points[idx]->uv, 2 * sizeof(float));
|
||||
memcpy(tex + idx * 4, points[idx]->uv, 2 * sizeof(float));
|
||||
if (hasColor)
|
||||
memcpy(col + idx * 4, Vec4f::FromRGBA(points[idx]->color_32).AsArray(), 4 * sizeof(float));
|
||||
}
|
||||
|
@ -1011,10 +1010,10 @@ void DrawEngineCommon::SubmitBezier(const void *control_points, const void *indi
|
|||
ERROR_LOG(G3D, "Something went really wrong, vertex size: %i vs %i", vertexSize, (int)sizeof(SimpleVertex));
|
||||
}
|
||||
|
||||
int stride = g_Config.iGPUBackend == GPU_BACKEND_VULKAN || g_Config.iGPUBackend == GPU_BACKEND_DIRECT3D11 ? 4 : 3;
|
||||
float *pos = (float*)(decoded + 65536 * 18); // Size 3 float (4 for Vulkan and D3D11)
|
||||
float *tex = pos + count_u * count_v * stride; // Size 3 float (4 for Vulkan and D3D11)
|
||||
float *col = tex + count_u * count_v * stride; // Size 4 float
|
||||
|
||||
float *pos = (float*)(decoded + 65536 * 18); // Size 4 float
|
||||
float *tex = pos + count_u * count_v * 4; // Size 4 float
|
||||
float *col = tex + count_u * count_v * 4; // Size 4 float
|
||||
const bool hasColor = (origVertType & GE_VTYPE_COL_MASK) != 0;
|
||||
const bool hasTexCoords = (origVertType & GE_VTYPE_TC_MASK) != 0;
|
||||
|
||||
|
@ -1023,13 +1022,12 @@ 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) {
|
||||
if (g_Config.iGPUBackend == GPU_BACKEND_VULKAN)
|
||||
tessDataTransfer->PrepareBuffers(pos, tex, col, count_u * count_v, hasColor, hasTexCoords);
|
||||
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 * stride, point->pos.AsArray(), 3 * sizeof(float));
|
||||
memcpy(pos + idx * 4, point->pos.AsArray(), 3 * sizeof(float));
|
||||
if (hasTexCoords)
|
||||
memcpy(tex + idx * stride, point->uv, 2 * sizeof(float));
|
||||
memcpy(tex + idx * 4, point->uv, 2 * sizeof(float));
|
||||
if (hasColor)
|
||||
memcpy(col + idx * 4, Vec4f::FromRGBA(point->color_32).AsArray(), 4 * sizeof(float));
|
||||
}
|
||||
|
|
|
@ -1118,10 +1118,10 @@ void DrawEngineGLES::TessellationDataTransferGLES::SendDataToShader(const float
|
|||
glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
if (prevSize < size) {
|
||||
glTexImage1D(GL_TEXTURE_1D, 0, GL_RGB32F, size, 0, GL_RGB, GL_FLOAT, (GLfloat*)pos);
|
||||
glTexImage1D(GL_TEXTURE_1D, 0, GL_RGBA32F, size, 0, GL_RGBA, GL_FLOAT, (GLfloat*)pos);
|
||||
prevSize = size;
|
||||
} else {
|
||||
glTexSubImage1D(GL_TEXTURE_1D, 0, 0, size, GL_RGB, GL_FLOAT, (GLfloat*)pos);
|
||||
glTexSubImage1D(GL_TEXTURE_1D, 0, 0, size, GL_RGBA, GL_FLOAT, (GLfloat*)pos);
|
||||
}
|
||||
|
||||
// Texcoords
|
||||
|
@ -1133,10 +1133,10 @@ void DrawEngineGLES::TessellationDataTransferGLES::SendDataToShader(const float
|
|||
glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
if (prevSizeTex < size) {
|
||||
glTexImage1D(GL_TEXTURE_1D, 0, GL_RGB32F, size, 0, GL_RGB, GL_FLOAT, (GLfloat*)tex);
|
||||
glTexImage1D(GL_TEXTURE_1D, 0, GL_RGBA32F, size, 0, GL_RGBA, GL_FLOAT, (GLfloat*)tex);
|
||||
prevSizeTex = size;
|
||||
} else {
|
||||
glTexSubImage1D(GL_TEXTURE_1D, 0, 0, size, GL_RGB, GL_FLOAT, (GLfloat*)tex);
|
||||
glTexSubImage1D(GL_TEXTURE_1D, 0, 0, size, GL_RGBA, GL_FLOAT, (GLfloat*)tex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1165,10 +1165,10 @@ void DrawEngineGLES::TessellationDataTransferGLES::SendDataToShader(const float
|
|||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
if (prevSize < size) {
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB32F, size, 1, 0, GL_RGB, GL_FLOAT, (GLfloat*)pos);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, size, 1, 0, GL_RGBA, GL_FLOAT, (GLfloat*)pos);
|
||||
prevSize = size;
|
||||
} else {
|
||||
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, size, 1, GL_RGB, GL_FLOAT, (GLfloat*)pos);
|
||||
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, size, 1, GL_RGBA, GL_FLOAT, (GLfloat*)pos);
|
||||
}
|
||||
|
||||
// Texcoords
|
||||
|
@ -1180,10 +1180,10 @@ void DrawEngineGLES::TessellationDataTransferGLES::SendDataToShader(const float
|
|||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
if (prevSizeTex < size) {
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB32F, size, 1, 0, GL_RGB, GL_FLOAT, (GLfloat*)tex);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, size, 1, 0, GL_RGBA, GL_FLOAT, (GLfloat*)tex);
|
||||
prevSizeTex = size;
|
||||
} else {
|
||||
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, size, 1, GL_RGB, GL_FLOAT, (GLfloat*)tex);
|
||||
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, size, 1, GL_RGBA, GL_FLOAT, (GLfloat*)tex);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue