Fix DecFmt bug

This commit is contained in:
Henrik Rydgård 2018-04-10 12:12:29 +02:00
parent 6a90b8fbb4
commit 1c99ebcbcc
4 changed files with 14 additions and 8 deletions

View File

@ -77,12 +77,16 @@ void DecVtxFormat::ComputeID() {
void DecVtxFormat::InitializeFromID(uint32_t id) {
this->id = id;
uvfmt = (id & 0xF);
c0fmt = ((id >> 4) & 0xF);
c1fmt = ((id >> 8) & 0xF);
nrmfmt = ((id >> 12) & 0xF);
posfmt = ((id >> 16) & 0xF);
uvoff = 0;
w0fmt = ((id) & 0xF);
w1fmt = ((id >> 4) & 0xF);
uvfmt = ((id >> 8) & 0xF);
c0fmt = ((id >> 12) & 0xF);
c1fmt = ((id >> 16) & 0xF);
nrmfmt = ((id >> 20) & 0xF);
posfmt = ((id >> 24) & 0xF);
w0off = 0;
w1off = w0off + DecFmtSize(w0fmt);
uvoff = w1off + DecFmtSize(w1fmt);
c0off = uvoff + DecFmtSize(uvfmt);
c1off = c0off + DecFmtSize(c0fmt);
nrmoff = c1off + DecFmtSize(c1fmt);

View File

@ -790,7 +790,7 @@ std::string ShaderManagerGLES::DebugGetShaderString(std::string id, DebugShaderT
// as sometimes these features might have an effect on the ID bits.
#define CACHE_HEADER_MAGIC 0x83277592
#define CACHE_VERSION 8
#define CACHE_VERSION 10
struct CacheHeader {
uint32_t magic;
uint32_t version;

View File

@ -76,6 +76,8 @@ static const DeclTypeInfo VComp[] = {
};
static void VertexAttribSetup(VkVertexInputAttributeDescription *attr, int fmt, int offset, PspAttributeLocation location) {
assert(fmt != DEC_NONE);
assert(fmt < ARRAY_SIZE(VComp));
attr->location = (uint32_t)location;
attr->binding = 0;
attr->format = VComp[fmt].type;

View File

@ -350,7 +350,7 @@ VulkanFragmentShader *ShaderManagerVulkan::GetFragmentShaderFromModule(VkShaderM
// instantaneous.
#define CACHE_HEADER_MAGIC 0xff51f420
#define CACHE_VERSION 10
#define CACHE_VERSION 12
struct VulkanCacheHeader {
uint32_t magic;
uint32_t version;