mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-26 23:55:40 +00:00
GPU/ShaderGen: Use [unroll] for resolve loops
This commit is contained in:
parent
719710ef98
commit
98af6e7228
|
@ -1052,7 +1052,7 @@ float4 LoadVRAM(int2 coords)
|
|||
{
|
||||
#if MULTISAMPLING
|
||||
float4 value = LOAD_TEXTURE_MS(samp0, coords, 0u);
|
||||
for (uint sample_index = 1u; sample_index < MULTISAMPLES; sample_index++)
|
||||
FOR_UNROLL (uint sample_index = 1u; sample_index < MULTISAMPLES; sample_index++)
|
||||
value += LOAD_TEXTURE_MS(samp0, coords, sample_index);
|
||||
value /= float(MULTISAMPLES);
|
||||
return value;
|
||||
|
@ -1156,7 +1156,7 @@ float4 LoadVRAM(int2 coords)
|
|||
{
|
||||
#if MULTISAMPLING
|
||||
float4 value = LOAD_TEXTURE_MS(samp0, coords, 0u);
|
||||
for (uint sample_index = 1u; sample_index < MULTISAMPLES; sample_index++)
|
||||
FOR_UNROLL (uint sample_index = 1u; sample_index < MULTISAMPLES; sample_index++)
|
||||
value += LOAD_TEXTURE_MS(samp0, coords, sample_index);
|
||||
value /= float(MULTISAMPLES);
|
||||
return value;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#pragma once
|
||||
#include "types.h"
|
||||
|
||||
static constexpr u32 SHADER_CACHE_VERSION = 5;
|
||||
static constexpr u32 SHADER_CACHE_VERSION = 6;
|
|
@ -173,6 +173,10 @@ void ShaderGen::WriteHeader(std::stringstream& ss)
|
|||
|
||||
ss << "#define CONSTANT const\n";
|
||||
ss << "#define GLOBAL\n";
|
||||
ss << "#define FOR_UNROLL for\n";
|
||||
ss << "#define FOR_LOOP for\n";
|
||||
ss << "#define IF_BRANCH if\n";
|
||||
ss << "#define IF_FLATTEN if\n";
|
||||
ss << "#define VECTOR_EQ(a, b) ((a) == (b))\n";
|
||||
ss << "#define VECTOR_NEQ(a, b) ((a) != (b))\n";
|
||||
ss << "#define VECTOR_COMP_EQ(a, b) equal((a), (b))\n";
|
||||
|
@ -214,6 +218,10 @@ void ShaderGen::WriteHeader(std::stringstream& ss)
|
|||
ss << "#define mat4 float4x4\n";
|
||||
ss << "#define CONSTANT static const\n";
|
||||
ss << "#define GLOBAL static\n";
|
||||
ss << "#define FOR_UNROLL [unroll] for\n";
|
||||
ss << "#define FOR_LOOP [loop] for\n";
|
||||
ss << "#define IF_BRANCH [branch] if\n";
|
||||
ss << "#define IF_FLATTEN [flatten] if\n";
|
||||
ss << "#define VECTOR_EQ(a, b) (all((a) == (b)))\n";
|
||||
ss << "#define VECTOR_NEQ(a, b) (any((a) != (b)))\n";
|
||||
ss << "#define VECTOR_COMP_EQ(a, b) ((a) == (b))\n";
|
||||
|
|
Loading…
Reference in a new issue