mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 13:30:02 +00:00
Port some other minor changes over from #9255
This commit is contained in:
parent
0903bfb5f5
commit
1faae8b6d6
@ -113,7 +113,9 @@ struct ShaderID {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool operator != (const ShaderID &other) const {
|
||||
return !(*this == other);
|
||||
}
|
||||
bool Bit(int bit) const {
|
||||
return (d[bit >> 5] >> (bit & 31)) & 1;
|
||||
}
|
||||
|
@ -482,8 +482,6 @@ void GPU_D3D11::Execute_VertexTypeSkinning(u32 op, u32 diff) {
|
||||
}
|
||||
|
||||
void GPU_D3D11::Execute_Prim(u32 op, u32 diff) {
|
||||
SetDrawType(DRAW_PRIM);
|
||||
|
||||
// This drives all drawing. All other state we just buffer up, then we apply it only
|
||||
// when it's time to draw. As most PSP games set state redundantly ALL THE TIME, this is a huge optimization.
|
||||
|
||||
@ -495,6 +493,8 @@ void GPU_D3D11::Execute_Prim(u32 op, u32 diff) {
|
||||
if (count == 0)
|
||||
return;
|
||||
|
||||
SetDrawType(DRAW_PRIM, prim);
|
||||
|
||||
// Discard AA lines as we can't do anything that makes sense with these anyway. The SW plugin might, though.
|
||||
|
||||
if (gstate.isAntiAliasEnabled()) {
|
||||
@ -553,8 +553,6 @@ void GPU_D3D11::Execute_Prim(u32 op, u32 diff) {
|
||||
}
|
||||
|
||||
void GPU_D3D11::Execute_Bezier(u32 op, u32 diff) {
|
||||
SetDrawType(DRAW_BEZIER);
|
||||
|
||||
// We don't dirty on normal changes anymore as we prescale, but it's needed for splines/bezier.
|
||||
gstate_c.Dirty(DIRTY_UVSCALEOFFSET);
|
||||
|
||||
@ -588,6 +586,8 @@ void GPU_D3D11::Execute_Bezier(u32 op, u32 diff) {
|
||||
}
|
||||
|
||||
GEPatchPrimType patchPrim = gstate.getPatchPrimitiveType();
|
||||
SetDrawType(DRAW_BEZIER, PatchPrimToPrim(patchPrim));
|
||||
|
||||
int bz_ucount = op & 0xFF;
|
||||
int bz_vcount = (op >> 8) & 0xFF;
|
||||
bool computeNormals = gstate.isLightingEnabled();
|
||||
@ -612,8 +612,6 @@ void GPU_D3D11::Execute_Bezier(u32 op, u32 diff) {
|
||||
}
|
||||
|
||||
void GPU_D3D11::Execute_Spline(u32 op, u32 diff) {
|
||||
SetDrawType(DRAW_SPLINE);
|
||||
|
||||
// We don't dirty on normal changes anymore as we prescale, but it's needed for splines/bezier.
|
||||
gstate_c.Dirty(DIRTY_UVSCALEOFFSET);
|
||||
|
||||
@ -651,6 +649,7 @@ void GPU_D3D11::Execute_Spline(u32 op, u32 diff) {
|
||||
int sp_utype = (op >> 16) & 0x3;
|
||||
int sp_vtype = (op >> 18) & 0x3;
|
||||
GEPatchPrimType patchPrim = gstate.getPatchPrimitiveType();
|
||||
SetDrawType(DRAW_SPLINE, PatchPrimToPrim(patchPrim));
|
||||
bool computeNormals = gstate.isLightingEnabled();
|
||||
bool patchFacing = gstate.patchfacing & 1;
|
||||
u32 vertType = gstate.vertType;
|
||||
|
@ -279,6 +279,7 @@ void DrawEngineD3D11::ApplyDrawState(int prim) {
|
||||
dynState_.useStencil = false;
|
||||
|
||||
{
|
||||
keys_.raster.value = 0;
|
||||
if (gstate.isModeClear()) {
|
||||
keys_.raster.cullMode = D3D11_CULL_NONE;
|
||||
} else {
|
||||
@ -306,6 +307,7 @@ void DrawEngineD3D11::ApplyDrawState(int prim) {
|
||||
{
|
||||
// Set ColorMask/Stencil/Depth
|
||||
if (gstate.isModeClear()) {
|
||||
keys_.depthStencil.value = 0;
|
||||
keys_.depthStencil.depthTestEnable = true;
|
||||
keys_.depthStencil.depthCompareOp = D3D11_COMPARISON_ALWAYS;
|
||||
keys_.depthStencil.depthWriteEnable = gstate.isClearModeDepthMask();
|
||||
@ -333,6 +335,7 @@ void DrawEngineD3D11::ApplyDrawState(int prim) {
|
||||
}
|
||||
|
||||
} else {
|
||||
keys_.depthStencil.value = 0;
|
||||
// Depth Test
|
||||
if (gstate.isDepthTestEnabled()) {
|
||||
keys_.depthStencil.depthTestEnable = true;
|
||||
|
@ -449,8 +449,6 @@ void GPU_DX9::Execute_VertexTypeSkinning(u32 op, u32 diff) {
|
||||
}
|
||||
|
||||
void GPU_DX9::Execute_Prim(u32 op, u32 diff) {
|
||||
SetDrawType(DRAW_PRIM);
|
||||
|
||||
// This drives all drawing. All other state we just buffer up, then we apply it only
|
||||
// when it's time to draw. As most PSP games set state redundantly ALL THE TIME, this is a huge optimization.
|
||||
|
||||
@ -462,6 +460,8 @@ void GPU_DX9::Execute_Prim(u32 op, u32 diff) {
|
||||
if (count == 0)
|
||||
return;
|
||||
|
||||
SetDrawType(DRAW_PRIM, prim);
|
||||
|
||||
// Discard AA lines as we can't do anything that makes sense with these anyway. The SW plugin might, though.
|
||||
|
||||
if (gstate.isAntiAliasEnabled()) {
|
||||
@ -520,8 +520,6 @@ void GPU_DX9::Execute_Prim(u32 op, u32 diff) {
|
||||
}
|
||||
|
||||
void GPU_DX9::Execute_Bezier(u32 op, u32 diff) {
|
||||
SetDrawType(DRAW_BEZIER);
|
||||
|
||||
// We don't dirty on normal changes anymore as we prescale, but it's needed for splines/bezier.
|
||||
gstate_c.Dirty(DIRTY_UVSCALEOFFSET);
|
||||
|
||||
@ -555,6 +553,7 @@ void GPU_DX9::Execute_Bezier(u32 op, u32 diff) {
|
||||
}
|
||||
|
||||
GEPatchPrimType patchPrim = gstate.getPatchPrimitiveType();
|
||||
SetDrawType(DRAW_BEZIER, PatchPrimToPrim(patchPrim));
|
||||
int bz_ucount = op & 0xFF;
|
||||
int bz_vcount = (op >> 8) & 0xFF;
|
||||
bool computeNormals = gstate.isLightingEnabled();
|
||||
@ -568,8 +567,6 @@ void GPU_DX9::Execute_Bezier(u32 op, u32 diff) {
|
||||
}
|
||||
|
||||
void GPU_DX9::Execute_Spline(u32 op, u32 diff) {
|
||||
SetDrawType(DRAW_SPLINE);
|
||||
|
||||
// We don't dirty on normal changes anymore as we prescale, but it's needed for splines/bezier.
|
||||
gstate_c.Dirty(DIRTY_UVSCALEOFFSET);
|
||||
|
||||
@ -607,6 +604,7 @@ void GPU_DX9::Execute_Spline(u32 op, u32 diff) {
|
||||
int sp_utype = (op >> 16) & 0x3;
|
||||
int sp_vtype = (op >> 18) & 0x3;
|
||||
GEPatchPrimType patchPrim = gstate.getPatchPrimitiveType();
|
||||
SetDrawType(DRAW_SPLINE, PatchPrimToPrim(patchPrim));
|
||||
bool computeNormals = gstate.isLightingEnabled();
|
||||
bool patchFacing = gstate.patchfacing & 1;
|
||||
u32 vertType = gstate.vertType;
|
||||
|
@ -636,8 +636,6 @@ void GPU_GLES::ExecuteOp(u32 op, u32 diff) {
|
||||
}
|
||||
|
||||
void GPU_GLES::Execute_Prim(u32 op, u32 diff) {
|
||||
SetDrawType(DRAW_PRIM);
|
||||
|
||||
// This drives all drawing. All other state we just buffer up, then we apply it only
|
||||
// when it's time to draw. As most PSP games set state redundantly ALL THE TIME, this is a huge optimization.
|
||||
|
||||
@ -649,6 +647,8 @@ void GPU_GLES::Execute_Prim(u32 op, u32 diff) {
|
||||
if (count == 0)
|
||||
return;
|
||||
|
||||
SetDrawType(DRAW_PRIM, prim);
|
||||
|
||||
// Discard AA lines as we can't do anything that makes sense with these anyway. The SW plugin might, though.
|
||||
|
||||
if (gstate.isAntiAliasEnabled()) {
|
||||
@ -728,8 +728,6 @@ void GPU_GLES::Execute_VertexTypeSkinning(u32 op, u32 diff) {
|
||||
}
|
||||
|
||||
void GPU_GLES::Execute_Bezier(u32 op, u32 diff) {
|
||||
SetDrawType(DRAW_BEZIER);
|
||||
|
||||
// We don't dirty on normal changes anymore as we prescale, but it's needed for splines/bezier.
|
||||
gstate_c.Dirty(DIRTY_UVSCALEOFFSET);
|
||||
|
||||
@ -763,6 +761,8 @@ void GPU_GLES::Execute_Bezier(u32 op, u32 diff) {
|
||||
}
|
||||
|
||||
GEPatchPrimType patchPrim = gstate.getPatchPrimitiveType();
|
||||
SetDrawType(DRAW_BEZIER, PatchPrimToPrim(patchPrim));
|
||||
|
||||
int bz_ucount = op & 0xFF;
|
||||
int bz_vcount = (op >> 8) & 0xFF;
|
||||
bool computeNormals = gstate.isLightingEnabled();
|
||||
@ -787,8 +787,6 @@ void GPU_GLES::Execute_Bezier(u32 op, u32 diff) {
|
||||
}
|
||||
|
||||
void GPU_GLES::Execute_Spline(u32 op, u32 diff) {
|
||||
SetDrawType(DRAW_SPLINE);
|
||||
|
||||
// We don't dirty on normal changes anymore as we prescale, but it's needed for splines/bezier.
|
||||
gstate_c.Dirty(DIRTY_UVSCALEOFFSET);
|
||||
|
||||
@ -826,6 +824,7 @@ void GPU_GLES::Execute_Spline(u32 op, u32 diff) {
|
||||
int sp_utype = (op >> 16) & 0x3;
|
||||
int sp_vtype = (op >> 18) & 0x3;
|
||||
GEPatchPrimType patchPrim = gstate.getPatchPrimitiveType();
|
||||
SetDrawType(DRAW_SPLINE, PatchPrimToPrim(patchPrim));
|
||||
bool computeNormals = gstate.isLightingEnabled();
|
||||
bool patchFacing = gstate.patchfacing & 1;
|
||||
u32 vertType = gstate.vertType;
|
||||
|
@ -219,7 +219,7 @@ public:
|
||||
typedef void (GPUCommon::*CmdFunc)(u32 op, u32 diff);
|
||||
|
||||
protected:
|
||||
void SetDrawType(DrawType type) {
|
||||
void SetDrawType(DrawType type, GEPrimitiveType prim) {
|
||||
if (type != lastDraw_) {
|
||||
gstate_c.Dirty(DIRTY_UVSCALEOFFSET);
|
||||
lastDraw_ = type;
|
||||
|
@ -465,8 +465,6 @@ void GPU_Vulkan::ExecuteOp(u32 op, u32 diff) {
|
||||
}
|
||||
|
||||
void GPU_Vulkan::Execute_Prim(u32 op, u32 diff) {
|
||||
SetDrawType(DRAW_PRIM);
|
||||
|
||||
// This drives all drawing. All other state we just buffer up, then we apply it only
|
||||
// when it's time to draw. As most PSP games set state redundantly ALL THE TIME, this is a huge optimization.
|
||||
|
||||
@ -478,6 +476,8 @@ void GPU_Vulkan::Execute_Prim(u32 op, u32 diff) {
|
||||
if (count == 0)
|
||||
return;
|
||||
|
||||
SetDrawType(DRAW_PRIM, prim);
|
||||
|
||||
// Discard AA lines as we can't do anything that makes sense with these anyway. The SW plugin might, though.
|
||||
|
||||
if (gstate.isAntiAliasEnabled()) {
|
||||
@ -540,8 +540,6 @@ void GPU_Vulkan::Execute_VertexType(u32 op, u32 diff) {
|
||||
}
|
||||
|
||||
void GPU_Vulkan::Execute_Bezier(u32 op, u32 diff) {
|
||||
SetDrawType(DRAW_BEZIER);
|
||||
|
||||
// We don't dirty on normal changes anymore as we prescale, but it's needed for splines/bezier.
|
||||
gstate_c.Dirty(DIRTY_UVSCALEOFFSET);
|
||||
|
||||
@ -575,6 +573,8 @@ void GPU_Vulkan::Execute_Bezier(u32 op, u32 diff) {
|
||||
}
|
||||
|
||||
GEPatchPrimType patchPrim = gstate.getPatchPrimitiveType();
|
||||
SetDrawType(DRAW_BEZIER, PatchPrimToPrim(patchPrim));
|
||||
|
||||
int bz_ucount = op & 0xFF;
|
||||
int bz_vcount = (op >> 8) & 0xFF;
|
||||
bool computeNormals = gstate.isLightingEnabled();
|
||||
@ -599,8 +599,6 @@ void GPU_Vulkan::Execute_Bezier(u32 op, u32 diff) {
|
||||
}
|
||||
|
||||
void GPU_Vulkan::Execute_Spline(u32 op, u32 diff) {
|
||||
SetDrawType(DRAW_SPLINE);
|
||||
|
||||
// We don't dirty on normal changes anymore as we prescale, but it's needed for splines/bezier.
|
||||
gstate_c.Dirty(DIRTY_UVSCALEOFFSET);
|
||||
|
||||
@ -638,6 +636,7 @@ void GPU_Vulkan::Execute_Spline(u32 op, u32 diff) {
|
||||
int sp_utype = (op >> 16) & 0x3;
|
||||
int sp_vtype = (op >> 18) & 0x3;
|
||||
GEPatchPrimType patchPrim = gstate.getPatchPrimitiveType();
|
||||
SetDrawType(DRAW_SPLINE, PatchPrimToPrim(patchPrim));
|
||||
bool computeNormals = gstate.isLightingEnabled();
|
||||
bool patchFacing = gstate.patchfacing & 1;
|
||||
u32 vertType = gstate.vertType;
|
||||
|
@ -557,6 +557,15 @@ enum GEPatchPrimType
|
||||
GE_PATCHPRIM_UNKNOWN = 3,
|
||||
};
|
||||
|
||||
inline GEPrimitiveType PatchPrimToPrim(GEPatchPrimType type) {
|
||||
switch (type) {
|
||||
case GE_PATCHPRIM_TRIANGLES: return GE_PRIM_TRIANGLES;
|
||||
case GE_PATCHPRIM_LINES: return GE_PRIM_LINES;
|
||||
case GE_PATCHPRIM_POINTS: return GE_PRIM_POINTS;
|
||||
case GE_PATCHPRIM_UNKNOWN: default: return GE_PRIM_KEEP_PREVIOUS; // just something
|
||||
}
|
||||
}
|
||||
|
||||
enum GEPaletteFormat
|
||||
{
|
||||
GE_CMODE_16BIT_BGR5650,
|
||||
|
Loading…
Reference in New Issue
Block a user