softgpu: Centralize more prim drawing state.

This commit is contained in:
Unknown W. Brackets committed 2022-01-12 21:23:49 -08:00
1 parent d06f17d27b
commit d962fb35d3
3 files changed
+74 -53

No files matched your search

+6 -6
View File
@@ -102,7 +102,7 @@ void DrawSprite(const VertexData &v0, const VertexData &v1, const RasterizerStat
constexpr int MIN_LINES_PER_THREAD = 32;
if (gstate.isTextureMapEnabled()) {
if (state.enableTextures) {
// 1:1 (but with mirror support) texture mapping!
int s_start = v0.texturecoords.x;
int t_start = v0.texturecoords.y;
@@ -184,10 +184,10 @@ void DrawSprite(const VertexData &v0, const VertexData &v1, const RasterizerStat
int xoff = ((v0.screenpos.x & 15) + 1) / 2;
int yoff = ((v0.screenpos.y & 15) + 1) / 2;
float dsf = ds * (1.0f / (float)gstate.getTextureWidth(0));
float dtf = dt * (1.0f / (float)gstate.getTextureHeight(0));
float sf_start = s_start * (1.0f / (float)gstate.getTextureWidth(0));
float tf_start = t_start * (1.0f / (float)gstate.getTextureHeight(0));
float dsf = ds * (1.0f / (float)(1 << state.samplerID.width0Shift));
float dtf = dt * (1.0f / (float)(1 << state.samplerID.height0Shift));
float sf_start = s_start * (1.0f / (float)(1 << state.samplerID.width0Shift));
float tf_start = t_start * (1.0f / (float)(1 << state.samplerID.height0Shift));
ParallelRangeLoop(&g_threadManager, [=](int y1, int y2) {
float t = tf_start + (y1 - pos0.y) * dtf;
@@ -291,7 +291,7 @@ bool RectangleFastPath(const VertexData &v0, const VertexData &v1, const Rasteri
// We already have a fast path for clear in ClearRectangle.
bool state_check = !state.pixelID.clearMode && NoClampOrWrap(v0.texturecoords) && NoClampOrWrap(v1.texturecoords);
// TODO: No mipmap levels? Might be a font at level 1...
if ((coord_check || !gstate.isTextureMapEnabled()) && orient_check && state_check) {
if ((coord_check || !state.enableTextures) && orient_check && state_check) {
Rasterizer::DrawSprite(v0, v1, state);
return true;
}