mirror of
https://github.com/libretro/ppsspp.git
synced 2025-02-14 22:24:05 +00:00
Fix mixup with fragment shader ubo variables
This commit is contained in:
parent
3bf88d7475
commit
4c281f16ac
@ -713,6 +713,7 @@ void DrawEngineVulkan::Resized() {
|
||||
decJitCache_->Clear();
|
||||
lastVType_ = -1;
|
||||
dec_ = NULL;
|
||||
// TODO: We must also wipe pipelines.
|
||||
for (auto iter = decoderMap_.begin(); iter != decoderMap_.end(); iter++) {
|
||||
delete iter->second;
|
||||
}
|
||||
|
@ -53,13 +53,6 @@ bool GenerateVulkanGLSLFragmentShader(const ShaderID &id, char *buffer) {
|
||||
WRITE(p, "#extension GL_ARB_separate_shader_objects : enable\n");
|
||||
WRITE(p, "#extension GL_ARB_shading_language_420pack : enable\n");
|
||||
|
||||
// PowerVR needs highp to do the fog in MHU correctly.
|
||||
// Others don't.
|
||||
bool highpFog = (gl_extensions.bugs & BUG_PVR_SHADER_PRECISION_BAD) ? true : false;
|
||||
bool highpTexcoord = highpFog;
|
||||
|
||||
WRITE(p, "precision lowp float;\n");
|
||||
|
||||
bool lmode = id.Bit(FS_BIT_LMODE);
|
||||
bool doTexture = id.Bit(FS_BIT_DO_TEXTURE);
|
||||
bool enableFog = id.Bit(FS_BIT_ENABLE_FOG);
|
||||
@ -107,13 +100,13 @@ bool GenerateVulkanGLSLFragmentShader(const ShaderID &id, char *buffer) {
|
||||
if (lmode)
|
||||
WRITE(p, "layout (location = 2) %s in vec3 v_color1;\n", shading);
|
||||
if (enableFog) {
|
||||
WRITE(p, "layout (location = 3) %s in float v_fogdepth;\n", highpFog ? "highp" : "mediump");
|
||||
WRITE(p, "layout (location = 3) in float v_fogdepth;\n");
|
||||
}
|
||||
if (doTexture) {
|
||||
if (doTextureProjection)
|
||||
WRITE(p, "layout (location = 0) %s in vec3 v_texcoord;\n", highpTexcoord ? "highp" : "mediump");
|
||||
WRITE(p, "layout (location = 0) in vec3 v_texcoord;\n");
|
||||
else
|
||||
WRITE(p, "layout (location = 0) %s in vec2 v_texcoord;\n", highpTexcoord ? "highp" : "mediump");
|
||||
WRITE(p, "layout (location = 0) in vec2 v_texcoord;\n");
|
||||
}
|
||||
|
||||
if (enableAlphaTest && !alphaTestAgainstZero) {
|
||||
@ -134,7 +127,6 @@ bool GenerateVulkanGLSLFragmentShader(const ShaderID &id, char *buffer) {
|
||||
}
|
||||
|
||||
WRITE(p, "void main() {\n");
|
||||
|
||||
if (isModeClear) {
|
||||
// Clear mode does not allow any fancy shading.
|
||||
WRITE(p, " vec4 v = v_color0;\n");
|
||||
|
@ -202,7 +202,7 @@ void ShaderManagerVulkan::BaseUpdateUniforms(int dirtyUniforms) {
|
||||
Uint8x3ToFloat4_Alpha(ub_base.alphaColorRef, gstate.getColorTestRef(), (float)gstate.getAlphaTestRef());
|
||||
}
|
||||
if (dirtyUniforms & DIRTY_ALPHACOLORMASK) {
|
||||
Uint8x3ToFloat4(ub_base.colorTestMask, gstate.colortestmask);
|
||||
Uint8x3ToInt4(ub_base.colorTestMask, gstate.colortestmask);
|
||||
}
|
||||
if (dirtyUniforms & DIRTY_FOGCOLOR) {
|
||||
Uint8x3ToFloat4(ub_base.fogColor, gstate.fogcolor);
|
||||
|
@ -95,7 +95,7 @@ struct UB_VS_FS_Base {
|
||||
float fogColor[4];
|
||||
float texEnvColor[4];
|
||||
float alphaColorRef[4];
|
||||
float colorTestMask[4];
|
||||
int colorTestMask[4];
|
||||
float stencilReplace[4]; // only first float used
|
||||
float blendFixA[4];
|
||||
float blendFixB[4];
|
||||
@ -112,15 +112,15 @@ R"( mat4 proj_mtx;
|
||||
vec4 depthRange;
|
||||
vec2 fogcoef;
|
||||
vec4 matambientalpha;
|
||||
vec3 fogcolor;
|
||||
vec3 texenv;
|
||||
vec4 alphacolorref;
|
||||
ivec4 alphacolormask;
|
||||
float stencilReplaceValue;
|
||||
vec3 blendFixA;
|
||||
vec3 blendFixB;
|
||||
vec4 texclamp;
|
||||
vec2 texclampoff;
|
||||
vec4 alphacolorref;
|
||||
ivec4 alphacolormask;
|
||||
float stencilReplaceValue;
|
||||
vec3 texenv;
|
||||
vec3 fogcolor;
|
||||
)";
|
||||
|
||||
struct UB_VS_Lights {
|
||||
|
@ -1750,12 +1750,12 @@ void TextureCacheVulkan::LoadTextureLevel(TexCacheEntry &entry, int level, bool
|
||||
{
|
||||
PROFILE_THIS_SCOPE("decodetex");
|
||||
|
||||
// TODO: only do this once
|
||||
u32 texByteAlign = 1;
|
||||
|
||||
GETextureFormat tfmt = (GETextureFormat)entry.format;
|
||||
GEPaletteFormat clutformat = gstate.getClutPaletteFormat();
|
||||
int bufw;
|
||||
void *finalBuf = DecodeTextureLevel(GETextureFormat(entry.format), clutformat, level, texByteAlign, dstFmt, scaleFactor, &bufw);
|
||||
void *finalBuf = DecodeTextureLevel(tfmt, clutformat, level, texByteAlign, dstFmt, scaleFactor, &bufw);
|
||||
if (finalBuf == NULL) {
|
||||
return;
|
||||
}
|
||||
@ -1790,6 +1790,8 @@ void TextureCacheVulkan::LoadTextureLevel(TexCacheEntry &entry, int level, bool
|
||||
uint8_t *writePtr = entry.vkTex->texture_->Lock(level, &rowPitch);
|
||||
for (int y = 0; y < h; y++) {
|
||||
memcpy(writePtr + rowPitch * y, (const uint8_t *)pixelData + decPitch * y, rowBytes);
|
||||
// uncomment to make all textures white for debugging
|
||||
//memset(writePtr + rowPitch * y, 0xff, rowBytes);
|
||||
}
|
||||
entry.vkTex->texture_->Unlock();
|
||||
|
||||
|
@ -1193,5 +1193,11 @@ std::vector<std::string> Thin3DVKContext::GetFeatureList() {
|
||||
AddFeature(features, "textureCompressionASTC_LDR", available.textureCompressionASTC_LDR, enabled.textureCompressionASTC_LDR);
|
||||
AddFeature(features, "shaderClipDistance", available.shaderClipDistance, enabled.shaderClipDistance);
|
||||
AddFeature(features, "shaderCullDistance", available.shaderCullDistance, enabled.shaderCullDistance);
|
||||
|
||||
// Also list texture formats and their properties.
|
||||
for (int i = VK_FORMAT_BEGIN_RANGE; i <= VK_FORMAT_END_RANGE; i++) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
return features;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user