PixelShader: use the vertex const buffer for ppl
This commit is contained in:
parent
027baad73b
commit
d93f2973f7
|
@ -1087,8 +1087,9 @@ void Renderer::ApplyState(bool bUseDstAlpha)
|
|||
SetLogicOpMode();
|
||||
}
|
||||
|
||||
D3D::context->PSSetConstantBuffers(0, 1, &PixelShaderCache::GetConstantBuffer());
|
||||
D3D::context->VSSetConstantBuffers(0, 1, &VertexShaderCache::GetConstantBuffer());
|
||||
ID3D11Buffer* const_buffers[2] = {PixelShaderCache::GetConstantBuffer(), VertexShaderCache::GetConstantBuffer()};
|
||||
D3D::context->PSSetConstantBuffers(0, 2, const_buffers);
|
||||
D3D::context->VSSetConstantBuffers(0, 1, const_buffers+1);
|
||||
|
||||
D3D::context->PSSetShader(PixelShaderCache::GetActiveShader(), nullptr, 0);
|
||||
D3D::context->VSSetShader(VertexShaderCache::GetActiveShader(), nullptr, 0);
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "VideoCommon/LightingShaderGen.h"
|
||||
#include "VideoCommon/NativeVertexFormat.h"
|
||||
#include "VideoCommon/PixelShaderGen.h"
|
||||
#include "VideoCommon/VertexShaderGen.h"
|
||||
#include "VideoCommon/VideoConfig.h"
|
||||
#include "VideoCommon/XFMemory.h" // for texture projection mode
|
||||
|
||||
|
@ -218,9 +219,13 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T
|
|||
out.Write("\n");
|
||||
|
||||
if (ApiType == API_OPENGL)
|
||||
{
|
||||
out.Write("layout(std140%s) uniform PSBlock {\n", g_ActiveConfig.backend_info.bSupportsBindingLayout ? ", binding = 1" : "");
|
||||
}
|
||||
else
|
||||
out.Write("cbuffer PSBlock {\n");
|
||||
{
|
||||
out.Write("cbuffer PSBlock : register(b0) {\n");
|
||||
}
|
||||
out.Write(
|
||||
"\tint4 " I_COLORS"[4];\n"
|
||||
"\tint4 " I_KCOLORS"[4];\n"
|
||||
|
@ -239,6 +244,27 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T
|
|||
"\tint4 " I_PMATERIALS"[4];\n"
|
||||
"};\n");
|
||||
|
||||
if (ApiType == API_OPENGL)
|
||||
{
|
||||
out.Write("layout(std140%s) uniform VSBlock {\n", g_ActiveConfig.backend_info.bSupportsBindingLayout ? ", binding = 2" : "");
|
||||
}
|
||||
else
|
||||
{
|
||||
out.Write("cbuffer VSBlock : register(b1) {\n");
|
||||
}
|
||||
out.Write(
|
||||
"\tfloat4 " I_POSNORMALMATRIX"[6];\n"
|
||||
"\tfloat4 " I_PROJECTION"[4];\n"
|
||||
"\tint4 " I_MATERIALS"[4];\n"
|
||||
"\tint4 " I_LIGHT_COLORS"[8];\n"
|
||||
"\tfloat4 " I_LIGHTS"[32];\n"
|
||||
"\tfloat4 " I_TEXMATRICES"[24];\n"
|
||||
"\tfloat4 " I_TRANSFORMMATRICES"[64];\n"
|
||||
"\tfloat4 " I_NORMALMATRICES"[32];\n"
|
||||
"\tfloat4 " I_POSTTRANSFORMMATRICES"[64];\n"
|
||||
"\tfloat4 " I_DEPTHPARAMS";\n"
|
||||
"};\n");
|
||||
|
||||
const bool forced_early_z = g_ActiveConfig.backend_info.bSupportsEarlyZ && bpmem.UseEarlyDepthTest() && (g_ActiveConfig.bFastDepthCalc || bpmem.alpha_test.TestResult() == AlphaTest::UNDETERMINED);
|
||||
const bool per_pixel_depth = (bpmem.ztex2.op != ZTEXTURE_DISABLE && bpmem.UseLateDepthTest()) || (!g_ActiveConfig.bFastDepthCalc && bpmem.zmode.testenable && !forced_early_z);
|
||||
|
||||
|
@ -355,7 +381,7 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T
|
|||
out.SetConstantsUsed(C_PLIGHTS, C_PLIGHTS+31); // TODO: Can be optimized further
|
||||
out.SetConstantsUsed(C_PMATERIALS, C_PMATERIALS+3);
|
||||
uid_data.components = components;
|
||||
GenerateLightingShader<T>(out, uid_data.lighting, components, I_PMATERIALS, I_PLIGHT_COLORS, I_PLIGHTS, "colors_", "colors_");
|
||||
GenerateLightingShader<T>(out, uid_data.lighting, components, I_MATERIALS, I_LIGHT_COLORS, I_LIGHTS, "colors_", "colors_");
|
||||
}
|
||||
|
||||
// HACK to handle cases where the tex gen is not enabled
|
||||
|
|
Loading…
Reference in New Issue