Vulkan: Uber shader support

This commit is contained in:
Stenzek
2017-07-20 15:25:35 +10:00
parent 4bf5625895
commit 81b4ed2a81
16 changed files with 738 additions and 164 deletions

View File

@ -354,21 +354,10 @@ void WritePixelShaderCommonHeader(ShaderCode& out, APIType ApiType, bool boundin
"int3 iround(float3 x) { return int3(round(x)); }\n"
"int4 iround(float4 x) { return int4(round(x)); }\n\n");
if (ApiType == APIType::OpenGL)
if (ApiType == APIType::OpenGL || ApiType == APIType::Vulkan)
{
out.Write("SAMPLER_BINDING(0) uniform sampler2DArray samp[8];\n");
}
else if (ApiType == APIType::Vulkan)
{
out.Write("SAMPLER_BINDING(0) uniform sampler2DArray samp0;\n");
out.Write("SAMPLER_BINDING(1) uniform sampler2DArray samp1;\n");
out.Write("SAMPLER_BINDING(2) uniform sampler2DArray samp2;\n");
out.Write("SAMPLER_BINDING(3) uniform sampler2DArray samp3;\n");
out.Write("SAMPLER_BINDING(4) uniform sampler2DArray samp4;\n");
out.Write("SAMPLER_BINDING(5) uniform sampler2DArray samp5;\n");
out.Write("SAMPLER_BINDING(6) uniform sampler2DArray samp6;\n");
out.Write("SAMPLER_BINDING(7) uniform sampler2DArray samp7;\n");
}
else // D3D
{
// Declare samplers
@ -1191,11 +1180,6 @@ static void SampleTexture(ShaderCode& out, const char* texcoords, const char* te
"[%d].xy, %s))).%s;\n",
texmap, texmap, texcoords, texmap, stereo ? "layer" : "0.0", texswap);
}
else if (ApiType == APIType::Vulkan)
{
out.Write("iround(255.0 * texture(samp%d, float3(%s.xy * " I_TEXDIMS "[%d].xy, %s))).%s;\n",
texmap, texcoords, texmap, stereo ? "layer" : "0.0", texswap);
}
else
{
out.Write("iround(255.0 * texture(samp[%d], float3(%s.xy * " I_TEXDIMS "[%d].xy, %s))).%s;\n",

View File

@ -44,13 +44,6 @@ static VertexLoaderMap s_vertex_loader_map;
u8* cached_arraybases[12];
// Used in the Vulkan backend
NativeVertexFormatMap* GetNativeVertexFormatMap()
{
return &s_native_vertex_map;
}
void Init()
{
MarkAllDirty();

View File

@ -24,8 +24,6 @@ void Clear();
void MarkAllDirty();
NativeVertexFormatMap* GetNativeVertexFormatMap();
// Creates or obtains a pointer to a VertexFormat representing decl.
// If this results in a VertexFormat being created, if the game later uses a matching vertex
// declaration, the one that was previously created will be used.