Just add some constants for the GL texture slots.

This commit is contained in:
Henrik Rydgård 2018-04-13 09:11:08 +02:00
parent 163350bbcd
commit 117dad8a48
5 changed files with 21 additions and 10 deletions

View file

@ -657,7 +657,7 @@ void DrawEngineGLES::TessellationDataTransferGLES::SendDataToShader(const float
data_tex[0] = renderManager_->CreateTexture(GL_TEXTURE_2D);
renderManager_->TextureImage(data_tex[0], 0, size, 1, GL_RGBA32F, GL_RGBA, GL_FLOAT, pos_data, GLRAllocType::NEW, false);
renderManager_->FinalizeTexture(data_tex[0], 0, false);
renderManager_->BindTexture(4, data_tex[0]);
renderManager_->BindTexture(TEX_SLOT_SPLINE_POS, data_tex[0]);
// Texcoords
if (hasTexCoords) {
@ -668,7 +668,7 @@ void DrawEngineGLES::TessellationDataTransferGLES::SendDataToShader(const float
data_tex[1] = renderManager_->CreateTexture(GL_TEXTURE_2D);
renderManager_->TextureImage(data_tex[1], 0, size, 1, GL_RGBA32F, GL_RGBA, GL_FLOAT, tex_data, GLRAllocType::NEW, false);
renderManager_->FinalizeTexture(data_tex[1], 0, false);
renderManager_->BindTexture(5, data_tex[1]);
renderManager_->BindTexture(TEX_SLOT_SPLINE_NRM, data_tex[1]);
}
if (data_tex[2])
@ -680,7 +680,7 @@ void DrawEngineGLES::TessellationDataTransferGLES::SendDataToShader(const float
renderManager_->TextureImage(data_tex[2], 0, sizeColor, 1, GL_RGBA32F, GL_RGBA, GL_FLOAT, col_data, GLRAllocType::NEW, false);
renderManager_->FinalizeTexture(data_tex[2], 0, false);
renderManager_->BindTexture(6, data_tex[2]);
renderManager_->BindTexture(TEX_SLOT_SPLINE_COL, data_tex[2]);
}
void DrawEngineGLES::TessellationDataTransferGLES::EndFrame() {

View file

@ -41,6 +41,17 @@ struct TransformedVertex;
struct DecVtxFormat;
enum {
TEX_SLOT_PSP_TEXTURE = 0,
TEX_SLOT_SHADERBLEND_SRC = 1,
TEX_SLOT_ALPHATEST = 2,
TEX_SLOT_CLUT = 3,
TEX_SLOT_SPLINE_POS = 4,
TEX_SLOT_SPLINE_NRM = 5,
TEX_SLOT_SPLINE_COL = 6,
};
// States transitions:
// On creation: DRAWN_NEW
// DRAWN_NEW -> DRAWN_HASHING

View file

@ -403,7 +403,7 @@ void FramebufferManagerGLES::MakePixelTexture(const u8 *srcPixels, GEBufferForma
render_->FinalizeTexture(drawPixelsTex_, 0, false);
// TODO: Return instead?
render_->BindTexture(0, drawPixelsTex_);
render_->BindTexture(TEX_SLOT_PSP_TEXTURE, drawPixelsTex_);
}
void FramebufferManagerGLES::SetViewport2D(int x, int y, int w, int h) {

View file

@ -124,7 +124,7 @@ static const GLushort logicOps[] = {
inline void DrawEngineGLES::ResetShaderBlending() {
if (fboTexBound_) {
GLRenderManager *renderManager = (GLRenderManager *)draw_->GetNativeObject(Draw::NativeObject::RENDER_MANAGER);
renderManager->BindTexture(1, nullptr);
renderManager->BindTexture(TEX_SLOT_SHADERBLEND_SRC, nullptr);
fboTexBound_ = false;
}
}
@ -331,7 +331,7 @@ void DrawEngineGLES::ApplyDrawStateLate(bool setStencil, int stencilValue) {
if (!gstate.isModeClear()) {
// Apply last, once we know the alpha params of the texture.
if (gstate.isAlphaTestEnabled() || gstate.isColorTestEnabled()) {
fragmentTestCache_->BindTestTexture(2);
fragmentTestCache_->BindTestTexture(TEX_SLOT_ALPHATEST);
}
}
}

View file

@ -327,7 +327,7 @@ void TextureCacheGLES::BindTexture(TexCacheEntry *entry) {
}
void TextureCacheGLES::Unbind() {
render_->BindTexture(0, nullptr);
render_->BindTexture(TEX_SLOT_PSP_TEXTURE, nullptr);
InvalidateLastTexture();
}
@ -451,8 +451,8 @@ void TextureCacheGLES::ApplyTextureFramebuffer(TexCacheEntry *entry, VirtualFram
shaderApply.Use(render_, drawEngine_, shadeInputLayout_);
framebufferManagerGL_->BindFramebufferAsColorTexture(0, framebuffer, BINDFBCOLOR_SKIP_COPY);
render_->BindTexture(3, clutTexture);
render_->SetTextureSampler(3, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE, GL_NEAREST, GL_NEAREST, 0.0f);
render_->BindTexture(TEX_SLOT_CLUT, clutTexture);
render_->SetTextureSampler(TEX_SLOT_CLUT, GL_CLAMP_TO_EDGE, GL_CLAMP_TO_EDGE, GL_NEAREST, GL_NEAREST, 0.0f);
shaderApply.Shade(render_);
@ -662,7 +662,7 @@ void TextureCacheGLES::BuildTexture(TexCacheEntry *const entry) {
// This will rebind it, but that's okay.
// Need to actually bind it now - it might only have gotten bound in the init phase.
render_->BindTexture(0, entry->textureName);
render_->BindTexture(TEX_SLOT_PSP_TEXTURE, entry->textureName);
UpdateSamplingParams(*entry, true);
}