mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
[what][style][gpu] some coding style refine
This commit is contained in:
parent
84a829b352
commit
7cbb7a09e5
7 changed files with 12 additions and 40 deletions
|
@ -78,10 +78,6 @@ void GLQueueRunner::CreateDeviceObjects() {
|
|||
|
||||
void GLQueueRunner::DestroyDeviceObjects() {
|
||||
CHECK_GL_ERROR_IF_DEBUG();
|
||||
if (!nameCache_.empty()) {
|
||||
glDeleteTextures((GLsizei)nameCache_.size(), &nameCache_[0]);
|
||||
nameCache_.clear();
|
||||
}
|
||||
if (gl_extensions.ARB_vertex_array_object) {
|
||||
glDeleteVertexArrays(1, &globalVAO_);
|
||||
}
|
||||
|
@ -327,8 +323,8 @@ void GLQueueRunner::RunInitSteps(const std::vector<GLRInitStep> &steps, bool ski
|
|||
glCompileShader(shader);
|
||||
GLint success = 0;
|
||||
glGetShaderiv(shader, GL_COMPILE_STATUS, &success);
|
||||
std::string infoLog = GetInfoLog(shader, glGetShaderiv, glGetShaderInfoLog);
|
||||
if (!success) {
|
||||
std::string infoLog = GetInfoLog(shader, glGetShaderiv, glGetShaderInfoLog);
|
||||
std::string errorString = StringFromFormat(
|
||||
"Error in shader compilation for: %s\n"
|
||||
"Info log: %s\n"
|
||||
|
@ -799,10 +795,9 @@ void GLQueueRunner::PerformRenderPass(const GLRStep &step, bool first, bool last
|
|||
glDisable(GL_COLOR_LOGIC_OP);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (first && gl_extensions.ARB_vertex_array_object) {
|
||||
glBindVertexArray(globalVAO_);
|
||||
if (gl_extensions.ARB_vertex_array_object) {
|
||||
glBindVertexArray(globalVAO_);
|
||||
}
|
||||
}
|
||||
|
||||
GLRProgram *curProgram = nullptr;
|
||||
|
@ -1630,17 +1625,6 @@ void GLQueueRunner::CopyFromReadbackBuffer(GLRFramebuffer *framebuffer, int widt
|
|||
}
|
||||
}
|
||||
|
||||
GLuint GLQueueRunner::AllocTextureName() {
|
||||
if (nameCache_.empty()) {
|
||||
nameCache_.resize(TEXCACHE_NAME_CACHE_SIZE);
|
||||
glGenTextures(TEXCACHE_NAME_CACHE_SIZE, &nameCache_[0]);
|
||||
}
|
||||
u32 name = nameCache_.back();
|
||||
nameCache_.pop_back();
|
||||
CHECK_GL_ERROR_IF_DEBUG();
|
||||
return name;
|
||||
}
|
||||
|
||||
// On PC, we always use GL_DEPTH24_STENCIL8.
|
||||
// On Android, we try to use what's available.
|
||||
|
||||
|
|
|
@ -228,7 +228,6 @@ struct GLRInitStep {
|
|||
union {
|
||||
struct {
|
||||
GLRTexture *texture;
|
||||
GLenum target;
|
||||
} create_texture;
|
||||
struct {
|
||||
GLRShader *shader;
|
||||
|
@ -420,10 +419,6 @@ private:
|
|||
GLuint currentDrawHandle_ = 0;
|
||||
GLuint currentReadHandle_ = 0;
|
||||
|
||||
GLuint AllocTextureName();
|
||||
|
||||
// Texture name cache. Ripped straight from TextureCacheGLES.
|
||||
std::vector<GLuint> nameCache_;
|
||||
std::unordered_map<int, std::string> glStrings_;
|
||||
|
||||
bool sawOutOfMemory_ = false;
|
||||
|
|
|
@ -189,7 +189,7 @@ void GLRenderManager::BindFramebufferAsRenderTarget(GLRFramebuffer *fb, GLRRende
|
|||
#endif
|
||||
|
||||
// Eliminate dupes.
|
||||
if (steps_.size() && steps_.back()->render.framebuffer == fb && steps_.back()->stepType == GLRStepType::RENDER) {
|
||||
if (steps_.size() && steps_.back()->stepType == GLRStepType::RENDER && steps_.back()->render.framebuffer == fb) {
|
||||
if (color != GLRRenderPassAction::CLEAR && depth != GLRRenderPassAction::CLEAR && stencil != GLRRenderPassAction::CLEAR) {
|
||||
// We don't move to a new step, this bind was unnecessary and we can safely skip it.
|
||||
curRenderStep_ = steps_.back();
|
||||
|
@ -197,7 +197,7 @@ void GLRenderManager::BindFramebufferAsRenderTarget(GLRFramebuffer *fb, GLRRende
|
|||
}
|
||||
}
|
||||
if (curRenderStep_ && curRenderStep_->commands.size() == 0) {
|
||||
VLOG("Empty render step. Usually happens after uploading pixels..");
|
||||
VLOG("Empty render step. Usually happens after uploading pixels.");
|
||||
}
|
||||
|
||||
GLRStep *step = new GLRStep{ GLRStepType::RENDER };
|
||||
|
|
|
@ -413,7 +413,6 @@ public:
|
|||
void BeginFrame();
|
||||
// Can run on a different thread!
|
||||
void Finish();
|
||||
bool Run(GLRRenderThreadTask &task);
|
||||
|
||||
// Creation commands. These were not needed in Vulkan since there we can do that on the main thread.
|
||||
// We pass in width/height here even though it's not strictly needed until we support glTextureStorage
|
||||
|
@ -535,7 +534,7 @@ public:
|
|||
|
||||
// This starts a new step (like a "render pass" in Vulkan).
|
||||
//
|
||||
// After a "CopyFramebuffer" or the other functions that start "steps", you need to call this beforce
|
||||
// After a "CopyFramebuffer" or the other functions that start "steps", you need to call this before
|
||||
// making any new render state changes or draw calls.
|
||||
//
|
||||
// The following state needs to be reset by the caller after calling this (and will thus not safely carry over from
|
||||
|
@ -632,14 +631,6 @@ public:
|
|||
#endif
|
||||
}
|
||||
|
||||
void BindPixelPackBuffer(GLRBuffer *buffer) { // Want to support an offset but can't in ES 2.0. We supply an offset when binding the buffers instead.
|
||||
_dbg_assert_(curRenderStep_ && curRenderStep_->stepType == GLRStepType::RENDER);
|
||||
GLRRenderData data{ GLRRenderCommand::BIND_BUFFER };
|
||||
data.bind_buffer.buffer = buffer;
|
||||
data.bind_buffer.target = GL_PIXEL_PACK_BUFFER;
|
||||
curRenderStep_->commands.push_back(data);
|
||||
}
|
||||
|
||||
void BindIndexBuffer(GLRBuffer *buffer) { // Want to support an offset but can't in ES 2.0. We supply an offset when binding the buffers instead.
|
||||
_dbg_assert_(curRenderStep_ && curRenderStep_->stepType == GLRStepType::RENDER);
|
||||
GLRRenderData data{ GLRRenderCommand::BIND_BUFFER};
|
||||
|
@ -1008,6 +999,8 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
bool Run(GLRRenderThreadTask &task);
|
||||
|
||||
// Bad for performance but sometimes necessary for synchronous CPU readbacks (screenshots and whatnot).
|
||||
void FlushSync();
|
||||
|
||||
|
|
|
@ -1262,7 +1262,7 @@ bool OpenGLPipeline::LinkShaders(const PipelineDesc &desc) {
|
|||
for (int i = 0; i < (int)std::min((const uint32_t)samplers_.size(), MAX_TEXTURE_SLOTS); i++) {
|
||||
queries.push_back({ &locs_->samplerLocs_[i], samplers_[i].name, true });
|
||||
}
|
||||
samplersToCheck = (int)samplers_.size();
|
||||
samplersToCheck = (int)std::min((const uint32_t)samplers_.size(), MAX_TEXTURE_SLOTS);
|
||||
} else {
|
||||
queries.push_back({ &locs_->samplerLocs_[0], "sampler0" });
|
||||
queries.push_back({ &locs_->samplerLocs_[1], "sampler1" });
|
||||
|
|
|
@ -110,7 +110,7 @@ struct AtlasFont {
|
|||
char name[32];
|
||||
|
||||
// Returns 0 on no match.
|
||||
const AtlasChar *getChar(int utf32) const ;
|
||||
const AtlasChar *getChar(int utf32) const;
|
||||
};
|
||||
|
||||
struct AtlasImage {
|
||||
|
|
|
@ -44,7 +44,7 @@ public:
|
|||
|
||||
private:
|
||||
Draw::DrawContext *draw_ = nullptr;
|
||||
SDL_Window *window_;
|
||||
SDL_Window *window_ = nullptr;
|
||||
SDL_GLContext glContext = nullptr;
|
||||
GLRenderManager *renderManager_ = nullptr;
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue