mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-15 06:58:37 +02:00
Add HW bounding Box support to d3d backend
This commit is contained in:
@ -261,11 +261,20 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T
|
||||
|
||||
if (g_ActiveConfig.backend_info.bSupportsBBox)
|
||||
{
|
||||
out.Write(
|
||||
"layout(std140, binding = 3) buffer BBox {\n"
|
||||
"\tint4 bbox_data;\n"
|
||||
"};\n"
|
||||
);
|
||||
if (ApiType == API_OPENGL)
|
||||
{
|
||||
out.Write(
|
||||
"layout(std140, binding = 3) buffer BBox {\n"
|
||||
"\tint4 bbox_data;\n"
|
||||
"};\n"
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
out.Write(
|
||||
"globallycoherent RWBuffer<int> bbox_data : register(u2);\n"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
GenerateVSOutputStruct(out, ApiType);
|
||||
@ -582,12 +591,24 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T
|
||||
if (g_ActiveConfig.backend_info.bSupportsBBox && BoundingBox::active)
|
||||
{
|
||||
uid_data->bounding_box = true;
|
||||
out.Write(
|
||||
"\tif(bbox_data.x > int(gl_FragCoord.x)) atomicMin(bbox_data.x, int(gl_FragCoord.x));\n"
|
||||
"\tif(bbox_data.y < int(gl_FragCoord.x)) atomicMax(bbox_data.y, int(gl_FragCoord.x));\n"
|
||||
"\tif(bbox_data.z > int(gl_FragCoord.y)) atomicMin(bbox_data.z, int(gl_FragCoord.y));\n"
|
||||
"\tif(bbox_data.w < int(gl_FragCoord.y)) atomicMax(bbox_data.w, int(gl_FragCoord.y));\n"
|
||||
);
|
||||
if (ApiType == API_OPENGL)
|
||||
{
|
||||
out.Write(
|
||||
"\tif(bbox_data.x > int(gl_FragCoord.x)) atomicMin(bbox_data.x, int(gl_FragCoord.x));\n"
|
||||
"\tif(bbox_data.y < int(gl_FragCoord.x)) atomicMax(bbox_data.y, int(gl_FragCoord.x));\n"
|
||||
"\tif(bbox_data.z > int(gl_FragCoord.y)) atomicMin(bbox_data.z, int(gl_FragCoord.y));\n"
|
||||
"\tif(bbox_data.w < int(gl_FragCoord.y)) atomicMax(bbox_data.w, int(gl_FragCoord.y));\n"
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
out.Write(
|
||||
"\tif(bbox_data[0] > int(rawpos.x)) InterlockedMin(bbox_data[0], int(rawpos.x));\n"
|
||||
"\tif(bbox_data[1] < int(rawpos.x)) InterlockedMax(bbox_data[1], int(rawpos.x));\n"
|
||||
"\tif(bbox_data[2] > int(rawpos.y)) InterlockedMin(bbox_data[2], int(rawpos.y));\n"
|
||||
"\tif(bbox_data[3] < int(rawpos.y)) InterlockedMax(bbox_data[3], int(rawpos.y));\n"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
out.Write("}\n");
|
||||
|
Reference in New Issue
Block a user