[GPU] Make static and const methods if possible

This commit is contained in:
Herman Semenov 2024-04-05 17:04:31 +03:00
parent 8aac45fec0
commit b57dab2812
32 changed files with 64 additions and 64 deletions

View File

@ -1019,13 +1019,13 @@ int DrawEngineCommon::DecodeInds() {
return indexGen.VertexCount(); return indexGen.VertexCount();
} }
bool DrawEngineCommon::CanUseHardwareTransform(int prim) { bool DrawEngineCommon::CanUseHardwareTransform(int prim) const {
if (!useHWTransform_) if (!useHWTransform_)
return false; return false;
return !gstate.isModeThrough() && prim != GE_PRIM_RECTANGLES && prim > GE_PRIM_LINE_STRIP; return !gstate.isModeThrough() && prim != GE_PRIM_RECTANGLES && prim > GE_PRIM_LINE_STRIP;
} }
bool DrawEngineCommon::CanUseHardwareTessellation(GEPatchPrimType prim) { bool DrawEngineCommon::CanUseHardwareTessellation(GEPatchPrimType prim) const {
if (useHWTessellation_) { if (useHWTessellation_) {
return CanUseHardwareTransform(PatchPrimToPrim(prim)); return CanUseHardwareTransform(PatchPrimToPrim(prim));
} }

View File

@ -65,7 +65,7 @@ namespace Spline { struct Weight2D; }
class TessellationDataTransfer { class TessellationDataTransfer {
public: public:
virtual ~TessellationDataTransfer() {} virtual ~TessellationDataTransfer() {}
void CopyControlPoints(float *pos, float *tex, float *col, int posStride, int texStride, int colStride, const SimpleVertex *const *points, int size, u32 vertType); static void CopyControlPoints(float *pos, float *tex, float *col, int posStride, int texStride, int colStride, const SimpleVertex *const *points, int size, u32 vertType);
virtual void SendDataToShader(const SimpleVertex *const *points, int size_u, int size_v, u32 vertType, const Spline::Weight2D &weights) = 0; virtual void SendDataToShader(const SimpleVertex *const *points, int size_u, int size_v, u32 vertType, const Spline::Weight2D &weights) = 0;
}; };
@ -121,10 +121,10 @@ public:
template<class Surface> template<class Surface>
void SubmitCurve(const void *control_points, const void *indices, Surface &surface, u32 vertType, int *bytesRead, const char *scope); void SubmitCurve(const void *control_points, const void *indices, Surface &surface, u32 vertType, int *bytesRead, const char *scope);
void ClearSplineBezierWeights(); static void ClearSplineBezierWeights();
bool CanUseHardwareTransform(int prim); bool CanUseHardwareTransform(int prim) const;
bool CanUseHardwareTessellation(GEPatchPrimType prim); bool CanUseHardwareTessellation(GEPatchPrimType prim) const;
std::vector<std::string> DebugGetVertexLoaderIDs(); std::vector<std::string> DebugGetVertexLoaderIDs();
std::string DebugGetVertexLoaderString(std::string id, DebugShaderStringType stringType); std::string DebugGetVertexLoaderString(std::string id, DebugShaderStringType stringType);
@ -161,7 +161,7 @@ protected:
void ApplyFramebufferRead(FBOTexState *fboTexState); void ApplyFramebufferRead(FBOTexState *fboTexState);
inline int IndexSize(u32 vtype) const { static inline int IndexSize(u32 vtype) {
const u32 indexType = (vtype & GE_VTYPE_IDX_MASK); const u32 indexType = (vtype & GE_VTYPE_IDX_MASK);
if (indexType == GE_VTYPE_IDX_16BIT) { if (indexType == GE_VTYPE_IDX_16BIT) {
return 2; return 2;

View File

@ -1045,12 +1045,12 @@ void FramebufferManagerCommon::DownloadFramebufferOnSwitch(VirtualFramebuffer *v
} }
} }
bool FramebufferManagerCommon::ShouldDownloadFramebufferColor(const VirtualFramebuffer *vfb) const { bool FramebufferManagerCommon::ShouldDownloadFramebufferColor(const VirtualFramebuffer *vfb) {
// Dangan Ronpa hack // Dangan Ronpa hack
return PSP_CoreParameter().compat.flags().Force04154000Download && vfb->fb_address == 0x04154000; return PSP_CoreParameter().compat.flags().Force04154000Download && vfb->fb_address == 0x04154000;
} }
bool FramebufferManagerCommon::ShouldDownloadFramebufferDepth(const VirtualFramebuffer *vfb) const { bool FramebufferManagerCommon::ShouldDownloadFramebufferDepth(const VirtualFramebuffer *vfb) {
// Download depth buffer for Syphon Filter lens flares // Download depth buffer for Syphon Filter lens flares
if (!PSP_CoreParameter().compat.flags().ReadbackDepth || g_Config.iSkipGPUReadbackMode != (int)SkipGPUReadbackMode::NO_SKIP) { if (!PSP_CoreParameter().compat.flags().ReadbackDepth || g_Config.iSkipGPUReadbackMode != (int)SkipGPUReadbackMode::NO_SKIP) {
return false; return false;
@ -2895,7 +2895,7 @@ Draw::Framebuffer *FramebufferManagerCommon::GetTempFBO(TempFBO reason, u16 w, u
return fbo; return fbo;
} }
void FramebufferManagerCommon::UpdateFramebufUsage(VirtualFramebuffer *vfb) { void FramebufferManagerCommon::UpdateFramebufUsage(VirtualFramebuffer *vfb) const {
auto checkFlag = [&](u16 flag, int last_frame) { auto checkFlag = [&](u16 flag, int last_frame) {
if (vfb->usageFlags & flag) { if (vfb->usageFlags & flag) {
const int age = frameLastFramebufUsed_ - last_frame; const int age = frameLastFramebufUsed_ - last_frame;

View File

@ -512,15 +512,15 @@ protected:
void EstimateDrawingSize(u32 fb_address, int fb_stride, GEBufferFormat fb_format, int viewport_width, int viewport_height, int region_width, int region_height, int scissor_width, int scissor_height, int &drawing_width, int &drawing_height); void EstimateDrawingSize(u32 fb_address, int fb_stride, GEBufferFormat fb_format, int viewport_width, int viewport_height, int region_width, int region_height, int scissor_width, int scissor_height, int &drawing_width, int &drawing_height);
void NotifyRenderFramebufferCreated(VirtualFramebuffer *vfb); void NotifyRenderFramebufferCreated(VirtualFramebuffer *vfb);
void NotifyRenderFramebufferUpdated(VirtualFramebuffer *vfb); static void NotifyRenderFramebufferUpdated(VirtualFramebuffer *vfb);
void NotifyRenderFramebufferSwitched(VirtualFramebuffer *prevVfb, VirtualFramebuffer *vfb, bool isClearingDepth); void NotifyRenderFramebufferSwitched(VirtualFramebuffer *prevVfb, VirtualFramebuffer *vfb, bool isClearingDepth);
void BlitFramebufferDepth(VirtualFramebuffer *src, VirtualFramebuffer *dst); void BlitFramebufferDepth(VirtualFramebuffer *src, VirtualFramebuffer *dst);
void ResizeFramebufFBO(VirtualFramebuffer *vfb, int w, int h, bool force = false, bool skipCopy = false); void ResizeFramebufFBO(VirtualFramebuffer *vfb, int w, int h, bool force = false, bool skipCopy = false);
bool ShouldDownloadFramebufferColor(const VirtualFramebuffer *vfb) const; static bool ShouldDownloadFramebufferColor(const VirtualFramebuffer *vfb);
bool ShouldDownloadFramebufferDepth(const VirtualFramebuffer *vfb) const; static bool ShouldDownloadFramebufferDepth(const VirtualFramebuffer *vfb);
void DownloadFramebufferOnSwitch(VirtualFramebuffer *vfb); void DownloadFramebufferOnSwitch(VirtualFramebuffer *vfb);
bool FindTransferFramebuffer(u32 basePtr, int stride, int x, int y, int w, int h, int bpp, bool destination, BlockTransferRect *rect); bool FindTransferFramebuffer(u32 basePtr, int stride, int x, int y, int w, int h, int bpp, bool destination, BlockTransferRect *rect);
@ -530,7 +530,7 @@ protected:
VirtualFramebuffer *CreateRAMFramebuffer(uint32_t fbAddress, int width, int height, int stride, GEBufferFormat format); VirtualFramebuffer *CreateRAMFramebuffer(uint32_t fbAddress, int width, int height, int stride, GEBufferFormat format);
void UpdateFramebufUsage(VirtualFramebuffer *vfb); void UpdateFramebufUsage(VirtualFramebuffer *vfb) const;
int GetFramebufferLayers() const; int GetFramebufferLayers() const;

View File

@ -521,8 +521,8 @@ public:
private: private:
bool parseFieldReference(const char *ref, const char *field, uint32_t &referenceIndex); bool parseFieldReference(const char *ref, const char *field, uint32_t &referenceIndex);
uint32_t getFieldValue(GECmdFormat fmt, GECmdField field, uint32_t value); static uint32_t getFieldValue(GECmdFormat fmt, GECmdField field, uint32_t value);
ExpressionType getFieldType(GECmdFormat fmt, GECmdField field); static ExpressionType getFieldType(GECmdFormat fmt, GECmdField field);
GPUDebugInterface *gpu_; GPUDebugInterface *gpu_;
}; };

View File

@ -639,7 +639,7 @@ void SoftwareTransform::BuildDrawingParams(int prim, int vertexCount, u32 vertTy
result->drawNumTrans = numTrans; result->drawNumTrans = numTrans;
} }
void SoftwareTransform::CalcCullParams(float &minZValue, float &maxZValue) { void SoftwareTransform::CalcCullParams(float &minZValue, float &maxZValue) const {
// The projected Z can be up to 0x3F8000FF, which is where this constant is from. // The projected Z can be up to 0x3F8000FF, which is where this constant is from.
// It seems like it may only maintain 15 mantissa bits (excluding implied.) // It seems like it may only maintain 15 mantissa bits (excluding implied.)
maxZValue = 1.000030517578125f * gstate_c.vpDepthScale; maxZValue = 1.000030517578125f * gstate_c.vpDepthScale;
@ -758,7 +758,7 @@ bool SoftwareTransform::ExpandRectangles(int vertexCount, int &numDecodedVerts,
return true; return true;
} }
bool SoftwareTransform::ExpandLines(int vertexCount, int &numDecodedVerts, int vertsSize, u16 *&inds, int indsSize, const TransformedVertex *transformed, TransformedVertex *transformedExpanded, int &numTrans, bool throughmode) const { bool SoftwareTransform::ExpandLines(int vertexCount, int &numDecodedVerts, int vertsSize, u16 *&inds, int indsSize, const TransformedVertex *transformed, TransformedVertex *transformedExpanded, int &numTrans, bool throughmode) {
// Before we start, do a sanity check - does the output fit? // Before we start, do a sanity check - does the output fit?
if ((vertexCount / 2) * 6 > indsSize) { if ((vertexCount / 2) * 6 > indsSize) {
// Won't fit, kill the draw. // Won't fit, kill the draw.
@ -892,7 +892,7 @@ bool SoftwareTransform::ExpandLines(int vertexCount, int &numDecodedVerts, int v
return true; return true;
} }
bool SoftwareTransform::ExpandPoints(int vertexCount, int &maxIndex, int vertsSize, u16 *&inds, int indsSize, const TransformedVertex *transformed, TransformedVertex *transformedExpanded, int &numTrans, bool throughmode) const { bool SoftwareTransform::ExpandPoints(int vertexCount, int &maxIndex, int vertsSize, u16 *&inds, int indsSize, const TransformedVertex *transformed, TransformedVertex *transformedExpanded, int &numTrans, bool throughmode) {
// Before we start, do a sanity check - does the output fit? // Before we start, do a sanity check - does the output fit?
if (vertexCount * 6 > indsSize) { if (vertexCount * 6 > indsSize) {
// Won't fit, kill the draw. // Won't fit, kill the draw.

View File

@ -74,10 +74,10 @@ public:
void BuildDrawingParams(int prim, int vertexCount, u32 vertType, u16 *&inds, int indsSize, int &numDecodedVerts, int vertsSize, SoftwareTransformResult *result); void BuildDrawingParams(int prim, int vertexCount, u32 vertType, u16 *&inds, int indsSize, int &numDecodedVerts, int vertsSize, SoftwareTransformResult *result);
protected: protected:
void CalcCullParams(float &minZValue, float &maxZValue); void CalcCullParams(float &minZValue, float &maxZValue) const;
bool ExpandRectangles(int vertexCount, int &numDecodedVerts, int vertsSize, u16 *&inds, int indsSize, const TransformedVertex *transformed, TransformedVertex *transformedExpanded, int &numTrans, bool throughmode, bool *pixelMappedExactly) const; bool ExpandRectangles(int vertexCount, int &numDecodedVerts, int vertsSize, u16 *&inds, int indsSize, const TransformedVertex *transformed, TransformedVertex *transformedExpanded, int &numTrans, bool throughmode, bool *pixelMappedExactly) const;
bool ExpandLines(int vertexCount, int &numDecodedVerts, int vertsSize, u16 *&inds, int indsSize, const TransformedVertex *transformed, TransformedVertex *transformedExpanded, int &numTrans, bool throughmode) const; static bool ExpandLines(int vertexCount, int &numDecodedVerts, int vertsSize, u16 *&inds, int indsSize, const TransformedVertex *transformed, TransformedVertex *transformedExpanded, int &numTrans, bool throughmode) ;
bool ExpandPoints(int vertexCount, int &numDecodedVerts, int vertsSize, u16 *&inds, int indsSize, const TransformedVertex *transformed, TransformedVertex *transformedExpanded, int &numTrans, bool throughmode) const; static bool ExpandPoints(int vertexCount, int &numDecodedVerts, int vertsSize, u16 *&inds, int indsSize, const TransformedVertex *transformed, TransformedVertex *transformedExpanded, int &numTrans, bool throughmode) ;
const SoftwareTransformParams &params_; const SoftwareTransformParams &params_;
Lin::Matrix4x4 projMatrix_; Lin::Matrix4x4 projMatrix_;

View File

@ -81,7 +81,7 @@ void BuildIndex(u16 *indices, int &count, int num_u, int num_v, GEPatchPrimType
class Bezier3DWeight { class Bezier3DWeight {
private: private:
void CalcWeights(float t, Weight &w) { static void CalcWeights(float t, Weight &w) {
// Bernstein 3D basis polynomial // Bernstein 3D basis polynomial
w.basis[0] = (1 - t) * (1 - t) * (1 - t); w.basis[0] = (1 - t) * (1 - t) * (1 - t);
w.basis[1] = 3 * t * (1 - t) * (1 - t); w.basis[1] = 3 * t * (1 - t) * (1 - t);
@ -95,7 +95,7 @@ private:
w.deriv[3] = 3 * t * t; w.deriv[3] = 3 * t * t;
} }
public: public:
Weight *CalcWeightsAll(u32 key) { static Weight *CalcWeightsAll(u32 key) {
int tess = (int)key; int tess = (int)key;
Weight *weights = new Weight[tess + 1]; Weight *weights = new Weight[tess + 1];
const float inv_tess = 1.0f / (float)tess; const float inv_tess = 1.0f / (float)tess;
@ -129,7 +129,7 @@ private:
}; };
// knot should be an array sized n + 5 (n + 1 + 1 + degree (cubic)) // knot should be an array sized n + 5 (n + 1 + 1 + degree (cubic))
void CalcKnots(int n, int type, float *knots, KnotDiv *divs) { static void CalcKnots(int n, int type, float *knots, KnotDiv *divs) {
// Basic theory (-2 to +3), optimized with KnotDiv (-2 to +0) // Basic theory (-2 to +3), optimized with KnotDiv (-2 to +0)
// for (int i = 0; i < n + 5; ++i) { // for (int i = 0; i < n + 5; ++i) {
for (int i = 0; i < n + 2; ++i) { for (int i = 0; i < n + 2; ++i) {
@ -160,7 +160,7 @@ private:
} }
} }
void CalcWeights(float t, const float *knots, const KnotDiv &div, Weight &w) { static void CalcWeights(float t, const float *knots, const KnotDiv &div, Weight &w) {
#ifdef _M_SSE #ifdef _M_SSE
const __m128 knot012 = _mm_loadu_ps(knots); const __m128 knot012 = _mm_loadu_ps(knots);
const __m128 t012 = _mm_sub_ps(_mm_set_ps1(t), knot012); const __m128 t012 = _mm_sub_ps(_mm_set_ps1(t), knot012);

View File

@ -400,7 +400,7 @@ protected:
virtual void BindAsClutTexture(Draw::Texture *tex, bool smooth) {} virtual void BindAsClutTexture(Draw::Texture *tex, bool smooth) {}
CheckAlphaResult DecodeTextureLevel(u8 *out, int outPitch, GETextureFormat format, GEPaletteFormat clutformat, uint32_t texaddr, int level, int bufw, TexDecodeFlags flags); CheckAlphaResult DecodeTextureLevel(u8 *out, int outPitch, GETextureFormat format, GEPaletteFormat clutformat, uint32_t texaddr, int level, int bufw, TexDecodeFlags flags);
void UnswizzleFromMem(u32 *dest, u32 destPitch, const u8 *texptr, u32 bufw, u32 height, u32 bytesPerPixel); static void UnswizzleFromMem(u32 *dest, u32 destPitch, const u8 *texptr, u32 bufw, u32 height, u32 bytesPerPixel);
CheckAlphaResult ReadIndexedTex(u8 *out, int outPitch, int level, const u8 *texptr, int bytesPerIndex, int bufw, bool reverseColors, bool expandTo32Bit); CheckAlphaResult ReadIndexedTex(u8 *out, int outPitch, int level, const u8 *texptr, int bytesPerIndex, int bufw, bool reverseColors, bool expandTo32Bit);
ReplacedTexture *FindReplacement(TexCacheEntry *entry, int *w, int *h, int *d); ReplacedTexture *FindReplacement(TexCacheEntry *entry, int *w, int *h, int *d);
void PollReplacement(TexCacheEntry *entry, int *w, int *h, int *d); void PollReplacement(TexCacheEntry *entry, int *w, int *h, int *d);
@ -418,7 +418,7 @@ protected:
return (const T *)clutBufRaw_; return (const T *)clutBufRaw_;
} }
u32 EstimateTexMemoryUsage(const TexCacheEntry *entry); static u32 EstimateTexMemoryUsage(const TexCacheEntry *entry);
SamplerCacheKey GetSamplingParams(int maxLevel, const TexCacheEntry *entry); SamplerCacheKey GetSamplingParams(int maxLevel, const TexCacheEntry *entry);
SamplerCacheKey GetFramebufferSamplingParams(u16 bufferWidth, u16 bufferHeight); SamplerCacheKey GetFramebufferSamplingParams(u16 bufferWidth, u16 bufferHeight);

View File

@ -723,7 +723,7 @@ public:
} }
}; };
bool TextureReplacer::WillSave(const ReplacedTextureDecodeInfo &replacedInfo) { bool TextureReplacer::WillSave(const ReplacedTextureDecodeInfo &replacedInfo) const {
if (!saveEnabled_) if (!saveEnabled_)
return false; return false;
// Don't save the PPGe texture. // Don't save the PPGe texture.

View File

@ -112,7 +112,7 @@ public:
ReplacedTexture *FindReplacement(u64 cachekey, u32 hash, int w, int h); ReplacedTexture *FindReplacement(u64 cachekey, u32 hash, int w, int h);
// Check if a NotifyTextureDecoded for this texture is desired (used to avoid reads from write-combined memory.) // Check if a NotifyTextureDecoded for this texture is desired (used to avoid reads from write-combined memory.)
bool WillSave(const ReplacedTextureDecodeInfo &replacedInfo); bool WillSave(const ReplacedTextureDecodeInfo &replacedInfo) const;
// Notify that a new texture was decoded. May already be upscaled, saves the data passed. // Notify that a new texture was decoded. May already be upscaled, saves the data passed.
// If the replacer knows about this one already, texture will be passed in, otherwise nullptr. // If the replacer knows about this one already, texture will be passed in, otherwise nullptr.
@ -140,7 +140,7 @@ protected:
float LookupReduceHashRange(int w, int h); float LookupReduceHashRange(int w, int h);
std::string LookupHashFile(u64 cachekey, u32 hash, bool *foundAlias, bool *ignored); std::string LookupHashFile(u64 cachekey, u32 hash, bool *foundAlias, bool *ignored);
void ScanForHashNamedFiles(VFSBackend *dir, std::map<ReplacementCacheKey, std::map<int, std::string>> &filenameMap); static void ScanForHashNamedFiles(VFSBackend *dir, std::map<ReplacementCacheKey, std::map<int, std::string>> &filenameMap);
void ComputeAliasMap(const std::map<ReplacementCacheKey, std::map<int, std::string>> &filenameMap); void ComputeAliasMap(const std::map<ReplacementCacheKey, std::map<int, std::string>> &filenameMap);
bool replaceEnabled_ = false; bool replaceEnabled_ = false;

View File

@ -595,7 +595,7 @@ TextureScalerCommon::TextureScalerCommon() {
TextureScalerCommon::~TextureScalerCommon() { TextureScalerCommon::~TextureScalerCommon() {
} }
bool TextureScalerCommon::IsEmptyOrFlat(const u32 *data, int pixels) const { bool TextureScalerCommon::IsEmptyOrFlat(const u32 *data, int pixels) {
u32 ref = data[0]; u32 ref = data[0];
// TODO: SIMD-ify this (although, for most textures we'll get out very early) // TODO: SIMD-ify this (although, for most textures we'll get out very early)
for (int i = 1; i < pixels; ++i) { for (int i = 1; i < pixels; ++i) {

View File

@ -37,15 +37,15 @@ public:
enum { XBRZ = 0, HYBRID = 1, BICUBIC = 2, HYBRID_BICUBIC = 3 }; enum { XBRZ = 0, HYBRID = 1, BICUBIC = 2, HYBRID_BICUBIC = 3 };
protected: protected:
void ScaleXBRZ(int factor, u32* source, u32* dest, int width, int height); static void ScaleXBRZ(int factor, u32* source, u32* dest, int width, int height);
void ScaleBilinear(int factor, u32* source, u32* dest, int width, int height); void ScaleBilinear(int factor, u32* source, u32* dest, int width, int height);
void ScaleBicubicBSpline(int factor, u32* source, u32* dest, int width, int height); static void ScaleBicubicBSpline(int factor, u32* source, u32* dest, int width, int height);
void ScaleBicubicMitchell(int factor, u32* source, u32* dest, int width, int height); static void ScaleBicubicMitchell(int factor, u32* source, u32* dest, int width, int height);
void ScaleHybrid(int factor, u32* source, u32* dest, int width, int height, bool bicubic = false); void ScaleHybrid(int factor, u32* source, u32* dest, int width, int height, bool bicubic = false);
void DePosterize(u32* source, u32* dest, int width, int height); void DePosterize(u32* source, u32* dest, int width, int height);
bool IsEmptyOrFlat(const u32 *data, int pixels) const; static bool IsEmptyOrFlat(const u32 *data, int pixels) ;
// depending on the factor and texture sizes, these can get pretty large // depending on the factor and texture sizes, these can get pretty large
// maximum is (100 MB total for a 512 by 512 texture with scaling factor 5 and hybrid scaling) // maximum is (100 MB total for a 512 by 512 texture with scaling factor 5 and hybrid scaling)

View File

@ -1488,7 +1488,7 @@ int VertexDecoder::ToString(char *output, bool spaces) const {
return output - start; return output - start;
} }
std::string VertexDecoder::GetString(DebugShaderStringType stringType) { std::string VertexDecoder::GetString(DebugShaderStringType stringType) const {
char buffer[256]; char buffer[256];
switch (stringType) { switch (stringType) {
case SHADER_STRING_SHORT_DESC: case SHADER_STRING_SHORT_DESC:

View File

@ -342,7 +342,7 @@ public:
int VertexSize() const { return size; } // PSP format size int VertexSize() const { return size; } // PSP format size
std::string GetString(DebugShaderStringType stringType); std::string GetString(DebugShaderStringType stringType) const;
void Step_WeightsU8() const; void Step_WeightsU8() const;
void Step_WeightsU16() const; void Step_WeightsU16() const;

View File

@ -464,7 +464,7 @@ bail:
} }
// TODO: Refactor this to a single USE flag. // TODO: Refactor this to a single USE flag.
bool DrawEngineGLES::SupportsHWTessellation() const { bool DrawEngineGLES::SupportsHWTessellation() {
bool hasTexelFetch = gl_extensions.GLES3 || (!gl_extensions.IsGLES && gl_extensions.VersionGEThan(3, 3, 0)) || gl_extensions.EXT_gpu_shader4; bool hasTexelFetch = gl_extensions.GLES3 || (!gl_extensions.IsGLES && gl_extensions.VersionGEThan(3, 3, 0)) || gl_extensions.EXT_gpu_shader4;
return hasTexelFetch && gstate_c.UseAll(GPU_USE_VERTEX_TEXTURE_FETCH | GPU_USE_TEXTURE_FLOAT | GPU_USE_INSTANCE_RENDERING); return hasTexelFetch && gstate_c.UseAll(GPU_USE_VERTEX_TEXTURE_FETCH | GPU_USE_TEXTURE_FLOAT | GPU_USE_INSTANCE_RENDERING);
} }

View File

@ -105,7 +105,7 @@ public:
void ClearInputLayoutMap(); void ClearInputLayoutMap();
bool SupportsHWTessellation() const; static bool SupportsHWTessellation() ;
protected: protected:
bool UpdateUseHWTessellation(bool enable) const override; bool UpdateUseHWTessellation(bool enable) const override;

View File

@ -85,7 +85,7 @@ void FragmentTestCacheGLES::BindTestTexture(int slot) {
cache_[id] = item; cache_[id] = item;
} }
FragmentTestID FragmentTestCacheGLES::GenerateTestID() const { FragmentTestID FragmentTestCacheGLES::GenerateTestID() {
FragmentTestID id; FragmentTestID id;
// Let's just keep it simple, it's all in here. // Let's just keep it simple, it's all in here.
id.alpha = gstate.isAlphaTestEnabled() ? gstate.alphatest : 0; id.alpha = gstate.isAlphaTestEnabled() ? gstate.alphatest : 0;

View File

@ -78,7 +78,7 @@ public:
private: private:
GLRTexture *CreateTestTexture(const GEComparison funcs[4], const u8 refs[4], const u8 masks[4], const bool valid[4]); GLRTexture *CreateTestTexture(const GEComparison funcs[4], const u8 refs[4], const u8 masks[4], const bool valid[4]);
FragmentTestID GenerateTestID() const; static FragmentTestID GenerateTestID() ;
GLRenderManager *render_; GLRenderManager *render_;
TextureCacheGLES *textureCache_; TextureCacheGLES *textureCache_;

View File

@ -379,7 +379,7 @@ static inline bool GuessVRDrawingHUD(bool is2D, bool flatScreen) {
return hud; return hud;
} }
void LinkedShader::use(const ShaderID &VSID) { void LinkedShader::use(const ShaderID &VSID) const {
render_->BindProgram(program); render_->BindProgram(program);
// Note that we no longer track attr masks here - we do it for the input layouts instead. // Note that we no longer track attr masks here - we do it for the input layouts instead.
} }
@ -1026,7 +1026,7 @@ bool ShaderManagerGLES::LoadCache(File::IOFile &f) {
linkPos = 0; linkPos = 0;
} }
bool Done() { bool Done() const {
return vertPos >= vert.size() && fragPos >= frag.size() && linkPos >= link.size(); return vertPos >= vert.size() && fragPos >= frag.size() && linkPos >= link.size();
} }
} diskCachePending_; } diskCachePending_;

View File

@ -40,7 +40,7 @@ public:
LinkedShader(GLRenderManager *render, VShaderID VSID, Shader *vs, FShaderID FSID, Shader *fs, bool useHWTransform, bool preloading = false); LinkedShader(GLRenderManager *render, VShaderID VSID, Shader *vs, FShaderID FSID, Shader *fs, bool useHWTransform, bool preloading = false);
~LinkedShader(); ~LinkedShader();
void use(const ShaderID &VSID); void use(const ShaderID &VSID) const;
void UpdateUniforms(const ShaderID &VSID, bool useBufferedRendering, const ShaderLanguageDesc &shaderLanguage); void UpdateUniforms(const ShaderID &VSID, bool useBufferedRendering, const ShaderLanguageDesc &shaderLanguage);
void Delete(); void Delete();
@ -181,7 +181,7 @@ public:
std::vector<std::string> DebugGetShaderIDs(DebugShaderType type) override; std::vector<std::string> DebugGetShaderIDs(DebugShaderType type) override;
std::string DebugGetShaderString(std::string id, DebugShaderType type, DebugShaderStringType stringType) override; std::string DebugGetShaderString(std::string id, DebugShaderType type, DebugShaderStringType stringType) override;
bool LoadCacheFlags(File::IOFile &f, DrawEngineGLES *drawEngine); static bool LoadCacheFlags(File::IOFile &f, DrawEngineGLES *drawEngine);
bool LoadCache(File::IOFile &f); bool LoadCache(File::IOFile &f);
void SaveCache(const Path &filename, DrawEngineGLES *drawEngine); void SaveCache(const Path &filename, DrawEngineGLES *drawEngine);

View File

@ -362,7 +362,7 @@ void TextureCacheGLES::BuildTexture(TexCacheEntry *const entry) {
} }
} }
Draw::DataFormat TextureCacheGLES::GetDestFormat(GETextureFormat format, GEPaletteFormat clutFormat) const { Draw::DataFormat TextureCacheGLES::GetDestFormat(GETextureFormat format, GEPaletteFormat clutFormat) {
switch (format) { switch (format) {
case GE_TFMT_CLUT4: case GE_TFMT_CLUT4:
case GE_TFMT_CLUT8: case GE_TFMT_CLUT8:

View File

@ -67,7 +67,7 @@ protected:
private: private:
void ApplySamplingParams(const SamplerCacheKey &key) override; void ApplySamplingParams(const SamplerCacheKey &key) override;
Draw::DataFormat GetDestFormat(GETextureFormat format, GEPaletteFormat clutFormat) const; static Draw::DataFormat GetDestFormat(GETextureFormat format, GEPaletteFormat clutFormat) ;
void UpdateCurrentClut(GEPaletteFormat clutFormat, u32 clutBase, bool clutIndexIsSimple) override; void UpdateCurrentClut(GEPaletteFormat clutFormat, u32 clutBase, bool clutIndexIsSimple) override;
void BuildTexture(TexCacheEntry *const entry) override; void BuildTexture(TexCacheEntry *const entry) override;

View File

@ -158,7 +158,7 @@ public:
void Execute_Unknown(u32 op, u32 diff); void Execute_Unknown(u32 op, u32 diff);
int EstimatePerVertexCost(); static int EstimatePerVertexCost();
// Note: Not virtual! // Note: Not virtual!
void Flush(); void Flush();

View File

@ -456,7 +456,7 @@ struct GPUgstate {
// Real data in the context ends here // Real data in the context ends here
void Reset(); static void Reset();
void Save(u32_le *ptr); void Save(u32_le *ptr);
void Restore(const u32_le *ptr); void Restore(const u32_le *ptr);
}; };
@ -720,7 +720,7 @@ public:
GEBufferFormat depalFramebufferFormat; GEBufferFormat depalFramebufferFormat;
u32 getRelativeAddress(u32 data) const; u32 getRelativeAddress(u32 data) const;
void Reset(); static void Reset();
void DoState(PointerWrap &p); void DoState(PointerWrap &p);
}; };

View File

@ -277,7 +277,7 @@ private:
void MarkPendingReads(const Rasterizer::RasterizerState &state); void MarkPendingReads(const Rasterizer::RasterizerState &state);
void MarkPendingWrites(const Rasterizer::RasterizerState &state); void MarkPendingWrites(const Rasterizer::RasterizerState &state);
bool HasTextureWrite(const Rasterizer::RasterizerState &state); bool HasTextureWrite(const Rasterizer::RasterizerState &state);
bool IsExactSelfRender(const Rasterizer::RasterizerState &state, const BinItem &item); static bool IsExactSelfRender(const Rasterizer::RasterizerState &state, const BinItem &item);
void OptimizePendingStates(uint16_t first, uint16_t last); void OptimizePendingStates(uint16_t first, uint16_t last);
BinCoords Scissor(BinCoords range); BinCoords Scissor(BinCoords range);
BinCoords Range(const VertexData &v0, const VertexData &v1, const VertexData &v2); BinCoords Range(const VertexData &v0, const VertexData &v1, const VertexData &v2);

View File

@ -66,7 +66,7 @@ public:
// Returns a pointer to the code to run. // Returns a pointer to the code to run.
SingleFunc GetSingle(const PixelFuncID &id, BinManager *binner); SingleFunc GetSingle(const PixelFuncID &id, BinManager *binner);
SingleFunc GenericSingle(const PixelFuncID &id); static SingleFunc GenericSingle(const PixelFuncID &id);
void Clear() override; void Clear() override;
void Flush(); void Flush();

View File

@ -30,27 +30,27 @@ struct FormatBuffer {
u32 *as32; u32 *as32;
}; };
inline void Set16(int x, int y, int stride, u16 v) { inline void Set16(int x, int y, int stride, u16 v) const {
as16[x + y * stride] = v; as16[x + y * stride] = v;
} }
inline void Set32(int x, int y, int stride, u32 v) { inline void Set32(int x, int y, int stride, u32 v) const {
as32[x + y * stride] = v; as32[x + y * stride] = v;
} }
inline u16 Get16(int x, int y, int stride) { inline u16 Get16(int x, int y, int stride) const {
return as16[x + y * stride]; return as16[x + y * stride];
} }
inline u32 Get32(int x, int y, int stride) { inline u32 Get32(int x, int y, int stride) const {
return as32[x + y * stride]; return as32[x + y * stride];
} }
inline u16 *Get16Ptr(int x, int y, int stride) { inline u16 *Get16Ptr(int x, int y, int stride) const {
return &as16[x + y * stride]; return &as16[x + y * stride];
} }
inline u32 *Get32Ptr(int x, int y, int stride) { inline u32 *Get32Ptr(int x, int y, int stride) const {
return &as32[x + y * stride]; return &as32[x + y * stride];
} }
}; };

View File

@ -139,7 +139,7 @@ public:
void SubmitPrimitive(const void* vertices, const void* indices, GEPrimitiveType prim_type, int vertex_count, u32 vertex_type, int *bytesRead, SoftwareDrawEngine *drawEngine); void SubmitPrimitive(const void* vertices, const void* indices, GEPrimitiveType prim_type, int vertex_count, u32 vertex_type, int *bytesRead, SoftwareDrawEngine *drawEngine);
void SubmitImmVertex(const ClipVertexData &vert, SoftwareDrawEngine *drawEngine); void SubmitImmVertex(const ClipVertexData &vert, SoftwareDrawEngine *drawEngine);
bool GetCurrentSimpleVertices(int count, std::vector<GPUDebugVertex> &vertices, std::vector<u16> &indices); static bool GetCurrentSimpleVertices(int count, std::vector<GPUDebugVertex> &vertices, std::vector<u16> &indices);
void Flush(const char *reason); void Flush(const char *reason);
void FlushIfOverlap(const char *reason, bool modifying, uint32_t addr, uint32_t stride, uint32_t w, uint32_t h); void FlushIfOverlap(const char *reason, bool modifying, uint32_t addr, uint32_t stride, uint32_t w, uint32_t h);

View File

@ -150,7 +150,7 @@ public:
return dest->Push(&ub_bones, sizeof(ub_bones), uboAlignment_, buf); return dest->Push(&ub_bones, sizeof(ub_bones), uboAlignment_, buf);
} }
bool LoadCacheFlags(FILE *f, DrawEngineVulkan *drawEngine); static bool LoadCacheFlags(FILE *f, DrawEngineVulkan *drawEngine);
bool LoadCache(FILE *f); bool LoadCache(FILE *f);
void SaveCache(FILE *f, DrawEngineVulkan *drawEngine); void SaveCache(FILE *f, DrawEngineVulkan *drawEngine);

View File

@ -699,7 +699,7 @@ void TextureCacheVulkan::BuildTexture(TexCacheEntry *const entry) {
} }
} }
VkFormat TextureCacheVulkan::GetDestFormat(GETextureFormat format, GEPaletteFormat clutFormat) const { VkFormat TextureCacheVulkan::GetDestFormat(GETextureFormat format, GEPaletteFormat clutFormat) {
if (!gstate_c.Use(GPU_USE_16BIT_FORMATS)) { if (!gstate_c.Use(GPU_USE_16BIT_FORMATS)) {
return VK_FORMAT_R8G8B8A8_UNORM; return VK_FORMAT_R8G8B8A8_UNORM;
} }

View File

@ -44,7 +44,7 @@ public:
void DeviceRestore(VulkanContext *vulkan); void DeviceRestore(VulkanContext *vulkan);
std::vector<std::string> DebugGetSamplerIDs() const; std::vector<std::string> DebugGetSamplerIDs() const;
std::string DebugGetSamplerString(const std::string &id, DebugShaderStringType stringType); static std::string DebugGetSamplerString(const std::string &id, DebugShaderStringType stringType);
private: private:
VulkanContext *vulkan_; VulkanContext *vulkan_;
@ -94,7 +94,7 @@ protected:
private: private:
void LoadVulkanTextureLevel(TexCacheEntry &entry, uint8_t *writePtr, int rowPitch, int level, int scaleFactor, VkFormat dstFmt); void LoadVulkanTextureLevel(TexCacheEntry &entry, uint8_t *writePtr, int rowPitch, int level, int scaleFactor, VkFormat dstFmt);
VkFormat GetDestFormat(GETextureFormat format, GEPaletteFormat clutFormat) const; static VkFormat GetDestFormat(GETextureFormat format, GEPaletteFormat clutFormat) ;
void UpdateCurrentClut(GEPaletteFormat clutFormat, u32 clutBase, bool clutIndexIsSimple) override; void UpdateCurrentClut(GEPaletteFormat clutFormat, u32 clutBase, bool clutIndexIsSimple) override;
void BuildTexture(TexCacheEntry *const entry) override; void BuildTexture(TexCacheEntry *const entry) override;