mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Use gstate.* accessors in a few more places.
This commit is contained in:
parent
55e02369a5
commit
c141e94fe9
11 changed files with 20 additions and 18 deletions
|
@ -475,7 +475,7 @@ void FramebufferManager::SetRenderFrameBuffer() {
|
|||
// As there are no clear "framebuffer width" and "framebuffer height" registers,
|
||||
// we need to infer the size of the current framebuffer somehow. Let's try the viewport.
|
||||
|
||||
GEBufferFormat fmt = static_cast<GEBufferFormat>(gstate.framebufpixformat & 3);
|
||||
GEBufferFormat fmt = gstate.FrameBufFormat();
|
||||
|
||||
int drawing_width, drawing_height;
|
||||
GuessDrawingSize(drawing_width, drawing_height);
|
||||
|
|
|
@ -729,7 +729,7 @@ void GLES_GPU::ExecuteOp(u32 op, u32 diff) {
|
|||
int sp_vcount = (data >> 8) & 0xFF;
|
||||
int sp_utype = (data >> 16) & 0x3;
|
||||
int sp_vtype = (data >> 18) & 0x3;
|
||||
int patchPrim = gstate.patchprimitive & 3;
|
||||
GEPatchPrimType patchPrim = gstate.getPatchPrimitiveType();
|
||||
transformDraw_.SubmitSpline(control_points, indices, sp_ucount, sp_vcount, sp_utype, sp_vtype, patchPrim, gstate.vertType);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -92,7 +92,7 @@ void CopyTriangle(u8 *&dest, u8 *v1, u8 *v2, u8 * v3, int vertexSize) {
|
|||
dest += vertexSize;
|
||||
}
|
||||
|
||||
void TransformDrawEngine::SubmitSpline(void* control_points, void* indices, int count_u, int count_v, int type_u, int type_v, u32 prim_type, u32 vertex_type)
|
||||
void TransformDrawEngine::SubmitSpline(void* control_points, void* indices, int count_u, int count_v, int type_u, int type_v, GEPatchPrimType prim_type, u32 vertex_type)
|
||||
{
|
||||
Flush();
|
||||
|
||||
|
|
|
@ -330,7 +330,7 @@ void TransformDrawEngine::ApplyDrawState(int prim) {
|
|||
renderHeightFactor = renderHeight / 272.0f;
|
||||
}
|
||||
|
||||
bool throughmode = (gstate.vertType & GE_VTYPE_THROUGH_MASK) != 0;
|
||||
bool throughmode = gstate.isModeThrough();
|
||||
|
||||
// Scissor
|
||||
int scissorX1 = gstate.getScissorX1();
|
||||
|
|
|
@ -550,8 +550,8 @@ static const GLuint MagFiltGL[2] = {
|
|||
void TextureCache::UpdateSamplingParams(TexCacheEntry &entry, bool force) {
|
||||
int minFilt = gstate.texfilter & 0x7;
|
||||
int magFilt = (gstate.texfilter>>8) & 1;
|
||||
bool sClamp = gstate.texwrap & 1;
|
||||
bool tClamp = (gstate.texwrap>>8) & 1;
|
||||
bool sClamp = gstate.isTexCoordClampedS();
|
||||
bool tClamp = gstate.isTexCoordClampedT();
|
||||
|
||||
bool noMip = (gstate.texlevel & 0xFFFFFF) == 0x000001 || (gstate.texlevel & 0xFFFFFF) == 0x100001 ; // Fix texlevel at 0
|
||||
|
||||
|
|
|
@ -150,7 +150,7 @@ private:
|
|||
};
|
||||
|
||||
Lighter::Lighter() {
|
||||
doShadeMapping_ = (gstate.texmapmode & 0x3) == 2;
|
||||
doShadeMapping_ = gstate.getUVGenMode() == GE_TEXMAP_ENVIRONMENT_MAP;
|
||||
materialEmissive.GetFromRGB(gstate.materialemissive);
|
||||
materialEmissive.a = 0.0f;
|
||||
globalAmbient.GetFromRGB(gstate.ambientcolor);
|
||||
|
@ -677,16 +677,17 @@ void TransformDrawEngine::SoftwareTransformAndDraw(
|
|||
((clearColor & 0xFF0000) >> 16) / 255.0f,
|
||||
((clearColor & 0xFF000000) >> 24) / 255.0f,
|
||||
};
|
||||
int target = 0;
|
||||
if ((gstate.clearmode >> 8) & 3) target |= GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT;
|
||||
if ((gstate.clearmode >> 10) & 1) target |= GL_DEPTH_BUFFER_BIT;
|
||||
|
||||
bool colorMask = (gstate.clearmode >> 8) & 1;
|
||||
bool alphaMask = (gstate.clearmode >> 9) & 1;
|
||||
bool colorMask = gstate.isClearModeColorMask();
|
||||
bool alphaMask = gstate.isClearModeAlphaMask();
|
||||
glstate.colorMask.set(colorMask, colorMask, colorMask, alphaMask);
|
||||
glstate.stencilTest.set(false);
|
||||
glstate.scissorTest.set(false);
|
||||
bool depthMask = (gstate.clearmode >> 10) & 1;
|
||||
bool depthMask = gstate.isClearModeDepthMask();
|
||||
|
||||
int target = 0;
|
||||
if (colorMask || alphaMask) target |= GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT;
|
||||
if (depthMask) target |= GL_DEPTH_BUFFER_BIT;
|
||||
|
||||
glClearColor(col[0], col[1], col[2], col[3]);
|
||||
#ifdef USING_GLES2
|
||||
|
|
|
@ -98,7 +98,7 @@ public:
|
|||
virtual ~TransformDrawEngine();
|
||||
void SubmitPrim(void *verts, void *inds, int prim, int vertexCount, u32 vertexType, int forceIndexType, int *bytesRead);
|
||||
void DrawBezier(int ucount, int vcount);
|
||||
void SubmitSpline(void* control_points, void* indices, int count_u, int count_v, int type_u, int type_v, u32 prim_type, u32 vertex_type);
|
||||
void SubmitSpline(void* control_points, void* indices, int count_u, int count_v, int type_u, int type_v, GEPatchPrimType prim_type, u32 vertex_type);
|
||||
|
||||
void DecodeVerts();
|
||||
void SetShaderManager(ShaderManager *shaderManager) {
|
||||
|
|
|
@ -225,6 +225,7 @@ struct GPUgstate
|
|||
bool isClearModeDepthWriteEnabled() const { return (clearmode&0x400) != 0; }
|
||||
bool isClearModeColorMask() const { return (clearmode&0x100) != 0; }
|
||||
bool isClearModeAlphaMask() const { return (clearmode&0x200) != 0; }
|
||||
bool isClearModeDepthMask() const { return (clearmode&0x400) != 0; }
|
||||
u32 getClearModeColorMask() const { return ((clearmode&0x100) ? 0xFFFFFF : 0) | ((clearmode&0x200) ? 0xFF000000 : 0); } // TODO: Different convention than getColorMask, confusing!
|
||||
|
||||
// Blend
|
||||
|
|
|
@ -363,7 +363,7 @@ void SoftGPU::ExecuteOp(u32 op, u32 diff)
|
|||
break;
|
||||
}
|
||||
|
||||
TransformUnit::SubmitSpline(control_points, indices, sp_ucount, sp_vcount, sp_utype, sp_vtype, gstate.patchprimitive&3, gstate.vertType);
|
||||
TransformUnit::SubmitSpline(control_points, indices, sp_ucount, sp_vcount, sp_utype, sp_vtype, gstate.getPatchPrimitiveType(), gstate.vertType);
|
||||
DEBUG_LOG(G3D,"DL DRAW SPLINE: %i x %i, %i x %i", sp_ucount, sp_vcount, sp_utype, sp_vtype);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -102,7 +102,7 @@ static VertexData ReadVertex(VertexReader& vreader)
|
|||
float pos[3];
|
||||
vreader.ReadPos(pos);
|
||||
|
||||
if (!gstate.isModeClear() && gstate.textureMapEnable && vreader.hasUV()) {
|
||||
if (!gstate.isModeClear() && gstate.isTextureMapEnabled() && vreader.hasUV()) {
|
||||
float uv[2];
|
||||
vreader.ReadUV(uv);
|
||||
vertex.texturecoords = Vec2<float>(uv[0], uv[1]);
|
||||
|
@ -186,7 +186,7 @@ struct SplinePatch {
|
|||
int type;
|
||||
};
|
||||
|
||||
void TransformUnit::SubmitSpline(void* control_points, void* indices, int count_u, int count_v, int type_u, int type_v, u32 prim_type, u32 vertex_type)
|
||||
void TransformUnit::SubmitSpline(void* control_points, void* indices, int count_u, int count_v, int type_u, int type_v, GEPatchPrimType prim_type, u32 vertex_type)
|
||||
{
|
||||
VertexDecoder vdecoder;
|
||||
vdecoder.SetVertexType(vertex_type);
|
||||
|
|
|
@ -115,6 +115,6 @@ public:
|
|||
static DrawingCoords ScreenToDrawing(const ScreenCoords& coords);
|
||||
static ScreenCoords DrawingToScreen(const DrawingCoords& coords);
|
||||
|
||||
static void SubmitSpline(void* control_points, void* indices, int count_u, int count_v, int type_u, int type_v, u32 prim_type, u32 vertex_type);
|
||||
static void SubmitSpline(void* control_points, void* indices, int count_u, int count_v, int type_u, int type_v, GEPatchPrimType prim_type, u32 vertex_type);
|
||||
static void SubmitPrimitive(void* vertices, void* indices, u32 prim_type, int vertex_count, u32 vertex_type);
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue