mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 05:19:56 +00:00
GPU: Skip cull for lines and points.
These already always go through software transform, so make sure we handle them consistently. We'll eventually convert to triangles.
This commit is contained in:
parent
8a718a8202
commit
9fc94a3494
@ -704,7 +704,7 @@ void DrawEngineCommon::SubmitPrim(void *verts, void *inds, GEPrimitiveType prim,
|
||||
*bytesRead = vertexCount * dec_->VertexSize();
|
||||
|
||||
// Check that we have enough vertices to form the requested primitive.
|
||||
if ((vertexCount < 2 && prim > 0) || (vertexCount < 3 && prim > 2 && prim != GE_PRIM_RECTANGLES))
|
||||
if ((vertexCount < 2 && prim > 0) || (vertexCount < 3 && prim > GE_PRIM_LINE_STRIP && prim != GE_PRIM_RECTANGLES))
|
||||
return;
|
||||
|
||||
if (g_Config.bVertexCache) {
|
||||
@ -750,7 +750,7 @@ void DrawEngineCommon::SubmitPrim(void *verts, void *inds, GEPrimitiveType prim,
|
||||
bool DrawEngineCommon::CanUseHardwareTransform(int prim) {
|
||||
if (!useHWTransform_)
|
||||
return false;
|
||||
return !gstate.isModeThrough() && prim != GE_PRIM_RECTANGLES;
|
||||
return !gstate.isModeThrough() && prim != GE_PRIM_RECTANGLES && prim > GE_PRIM_LINE_STRIP;
|
||||
}
|
||||
|
||||
bool DrawEngineCommon::CanUseHardwareTessellation(GEPatchPrimType prim) {
|
||||
|
@ -253,7 +253,7 @@ void DrawEngineD3D11::ApplyDrawState(int prim) {
|
||||
|
||||
if (gstate_c.IsDirty(DIRTY_RASTER_STATE)) {
|
||||
keys_.raster.value = 0;
|
||||
bool wantCull = !gstate.isModeClear() && prim != GE_PRIM_RECTANGLES && gstate.isCullEnabled();
|
||||
bool wantCull = !gstate.isModeClear() && prim != GE_PRIM_RECTANGLES && prim > GE_PRIM_LINE_STRIP && gstate.isCullEnabled();
|
||||
keys_.raster.cullMode = wantCull ? (gstate.getCullMode() ? D3D11_CULL_FRONT : D3D11_CULL_BACK) : D3D11_CULL_NONE;
|
||||
|
||||
if (gstate.isModeClear() || gstate.isModeThrough()) {
|
||||
|
@ -175,7 +175,7 @@ void DrawEngineDX9::ApplyDrawState(int prim) {
|
||||
} else {
|
||||
dxstate.dither.disable();
|
||||
}
|
||||
bool wantCull = !gstate.isModeClear() && prim != GE_PRIM_RECTANGLES && gstate.isCullEnabled();
|
||||
bool wantCull = !gstate.isModeClear() && prim != GE_PRIM_RECTANGLES && prim > GE_PRIM_LINE_STRIP && gstate.isCullEnabled();
|
||||
dxstate.cullMode.set(wantCull, gstate.getCullMode());
|
||||
if (gstate.isModeClear()) {
|
||||
// Well, probably doesn't matter...
|
||||
|
@ -229,7 +229,7 @@ void DrawEngineGLES::ApplyDrawState(int prim) {
|
||||
bool cullEnable;
|
||||
GLenum cullMode = cullingMode[gstate.getCullMode() ^ !useBufferedRendering];
|
||||
|
||||
cullEnable = !gstate.isModeClear() && prim != GE_PRIM_RECTANGLES && gstate.isCullEnabled();
|
||||
cullEnable = !gstate.isModeClear() && prim != GE_PRIM_RECTANGLES && prim > GE_PRIM_LINE_STRIP && gstate.isCullEnabled();
|
||||
|
||||
bool depthClampEnable = false;
|
||||
if (gstate.isModeClear() || gstate.isModeThrough()) {
|
||||
|
@ -265,6 +265,10 @@ protected:
|
||||
void DeviceLost() override;
|
||||
void DeviceRestore() override;
|
||||
|
||||
inline bool IsTrianglePrim(GEPrimitiveType prim) const {
|
||||
return prim != GE_PRIM_RECTANGLES && prim > GE_PRIM_LINE_STRIP;
|
||||
}
|
||||
|
||||
void SetDrawType(DrawType type, GEPrimitiveType prim) {
|
||||
if (type != lastDraw_) {
|
||||
// We always flush when drawing splines/beziers so no need to do so here
|
||||
@ -273,7 +277,7 @@ protected:
|
||||
}
|
||||
// Prim == RECTANGLES can cause CanUseHardwareTransform to flip, so we need to dirty.
|
||||
// Also, culling may be affected so dirty the raster state.
|
||||
if ((prim == GE_PRIM_RECTANGLES) != (lastPrim_ == GE_PRIM_RECTANGLES)) {
|
||||
if (IsTrianglePrim(prim) != IsTrianglePrim(lastPrim_)) {
|
||||
Flush();
|
||||
gstate_c.Dirty(DIRTY_RASTER_STATE | DIRTY_VERTEXSHADER_STATE);
|
||||
lastPrim_ = prim;
|
||||
|
@ -233,14 +233,13 @@ void DrawEngineVulkan::ConvertStateToVulkanKey(FramebufferManagerVulkan &fbManag
|
||||
}
|
||||
|
||||
if (gstate_c.IsDirty(DIRTY_RASTER_STATE)) {
|
||||
bool wantCull = !gstate.isModeClear() && prim != GE_PRIM_RECTANGLES && gstate.isCullEnabled();
|
||||
bool wantCull = !gstate.isModeClear() && prim != GE_PRIM_RECTANGLES && prim > GE_PRIM_LINE_STRIP && gstate.isCullEnabled();
|
||||
key.cullMode = wantCull ? (gstate.getCullMode() ? VK_CULL_MODE_FRONT_BIT : VK_CULL_MODE_BACK_BIT) : VK_CULL_MODE_NONE;
|
||||
|
||||
if (gstate.isModeClear() || gstate.isModeThrough()) {
|
||||
// TODO: Might happen in clear mode if not through...
|
||||
key.depthClampEnable = false;
|
||||
} else {
|
||||
// Set cull
|
||||
if (gstate.getDepthRangeMin() == 0 || gstate.getDepthRangeMax() == 65535) {
|
||||
// TODO: Still has a bug where we clamp to depth range if one is not the full range.
|
||||
// But the alternate is not clamping in either direction...
|
||||
|
Loading…
Reference in New Issue
Block a user