mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-28 16:53:40 +01:00
Simple micro-optimization in AdvanceVerts
This commit is contained in:
1 parent
4e7099bf47
commit
c4ccf5b734
4 files changed
+18
-20
No files matched your search
@@ -2253,20 +2253,6 @@ void GPUCommon::SetCmdValue(u32 op) {
|
||||
ExecuteOp(op, diff);
|
||||
}
|
||||
|
||||
void GPUCommon::AdvanceVerts(u32 vertType, int count, int bytesRead) {
|
||||
if ((vertType & GE_VTYPE_IDX_MASK) != GE_VTYPE_IDX_NONE) {
|
||||
int indexSize = 1;
|
||||
if ((vertType & GE_VTYPE_IDX_MASK) == GE_VTYPE_IDX_16BIT)
|
||||
indexSize = 2;
|
||||
else if ((vertType & GE_VTYPE_IDX_MASK) == GE_VTYPE_IDX_32BIT)
|
||||
indexSize = 4;
|
||||
gstate_c.indexAddr += count * indexSize;
|
||||
} else {
|
||||
gstate_c.vertexAddr += bytesRead;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GPUCommon::DoBlockTransfer(u32 skipDrawReason) {
|
||||
// TODO: This is used a lot to copy data around between render targets and textures,
|
||||
// and also to quickly load textures from RAM to VRAM. So we should do checks like the following:
|
||||
|
||||
+9
-2
@@ -233,7 +233,7 @@ protected:
|
||||
lastDraw_ = type;
|
||||
}
|
||||
// Prim == RECTANGLES can cause CanUseHardwareTransform to flip, so we need to dirty.
|
||||
// Also, culling may be affected.
|
||||
// Also, culling may be affected so dirty the raster state.
|
||||
if ((prim == GE_PRIM_RECTANGLES) != (lastPrim_ == GE_PRIM_RECTANGLES)) {
|
||||
gstate_c.Dirty(DIRTY_RASTER_STATE | DIRTY_VERTEXSHADER_STATE);
|
||||
lastPrim_ = prim;
|
||||
@@ -266,7 +266,14 @@ protected:
|
||||
|
||||
void DoBlockTransfer(u32 skipDrawReason);
|
||||
|
||||
void AdvanceVerts(u32 vertType, int count, int bytesRead);
|
||||
void AdvanceVerts(u32 vertType, int count, int bytesRead) {
|
||||
if ((vertType & GE_VTYPE_IDX_MASK) != GE_VTYPE_IDX_NONE) {
|
||||
int indexShift = ((vertType & GE_VTYPE_IDX_MASK) >> GE_VTYPE_IDX_SHIFT) - 1;
|
||||
gstate_c.indexAddr += count << indexShift;
|
||||
} else {
|
||||
gstate_c.vertexAddr += bytesRead;
|
||||
}
|
||||
}
|
||||
|
||||
void PerformMemoryCopyInternal(u32 dest, u32 src, int size);
|
||||
void PerformMemorySetInternal(u32 dest, u8 v, int size);
|
||||
|
||||
@@ -479,7 +479,7 @@ VkDescriptorSet DrawEngineVulkan::GetDescriptorSet(VkImageView imageView, VkSamp
|
||||
memset(writes, 0, sizeof(writes));
|
||||
// Main texture
|
||||
int n = 0;
|
||||
VkDescriptorImageInfo tex;
|
||||
VkDescriptorImageInfo tex{};
|
||||
if (imageView) {
|
||||
// TODO: Also support LAYOUT_GENERAL to be able to texture from framebuffers without transitioning them?
|
||||
tex.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
|
||||
@@ -499,7 +499,7 @@ VkDescriptorSet DrawEngineVulkan::GetDescriptorSet(VkImageView imageView, VkSamp
|
||||
|
||||
// Tessellation data textures
|
||||
if (gstate_c.bezier || gstate_c.spline) {
|
||||
VkDescriptorImageInfo tess_tex[3];
|
||||
VkDescriptorImageInfo tess_tex[3]{};
|
||||
VkSampler sampler = ((TessellationDataTransferVulkan *)tessDataTransfer)->GetSampler();
|
||||
for (int i = 0; i < 3; i++) {
|
||||
VulkanTexture *texture = ((TessellationDataTransferVulkan *)tessDataTransfer)->GetTexture(i);
|
||||
@@ -521,7 +521,7 @@ VkDescriptorSet DrawEngineVulkan::GetDescriptorSet(VkImageView imageView, VkSamp
|
||||
}
|
||||
|
||||
// Uniform buffer objects
|
||||
VkDescriptorBufferInfo buf[3];
|
||||
VkDescriptorBufferInfo buf[3]{};
|
||||
int count = 0;
|
||||
buf[count].buffer = base;
|
||||
buf[count].offset = 0;
|
||||
|
||||
@@ -130,6 +130,12 @@ void ResetShaderBlending() {
|
||||
// In Vulkan, we simply collect all the state together into a "pipeline key" - we don't actually set any state here
|
||||
// (the caller is responsible for setting the little dynamic state that is supported, dynState).
|
||||
void DrawEngineVulkan::ConvertStateToVulkanKey(FramebufferManagerVulkan &fbManager, ShaderManagerVulkan *shaderManager, int prim, VulkanPipelineRasterStateKey &key, VulkanDynamicState &dynState) {
|
||||
/*
|
||||
if (!gstate_c.IsDirty(DIRTY_BLEND_STATE | DIRTY_TEXTURE_IMAGE | DIRTY_TEXTURE_PARAMS | DIRTY_VIEWPORTSCISSOR_STATE | DIRTY_DEPTHRANGE | DIRTY_RASTER_STATE)) {
|
||||
// nothing to do
|
||||
return;
|
||||
}*/
|
||||
|
||||
bool useBufferedRendering = g_Config.iRenderingMode != FB_NON_BUFFERED_MODE;
|
||||
|
||||
if (gstate_c.IsDirty(DIRTY_BLEND_STATE)) {
|
||||
@@ -151,7 +157,6 @@ void DrawEngineVulkan::ConvertStateToVulkanKey(FramebufferManagerVulkan &fbManag
|
||||
bool colorMask = gstate.isClearModeColorMask();
|
||||
bool alphaMask = gstate.isClearModeAlphaMask();
|
||||
key.colorWriteMask = (colorMask ? (VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | VK_COLOR_COMPONENT_B_BIT) : 0) | (alphaMask ? VK_COLOR_COMPONENT_A_BIT : 0);
|
||||
|
||||
} else {
|
||||
key.logicOpEnable = false;
|
||||
key.logicOp = VK_LOGIC_OP_CLEAR;
|
||||
|
||||
Reference in new issue
Block a user