Fixed crash in r_debugSurface (tr_main.c). Minor tweaks.

This commit is contained in:
Artem Kharytoniuk 2018-01-13 13:10:59 +01:00
parent f38011533d
commit 9b106ec102
5 changed files with 24 additions and 27 deletions

View File

@ -1260,9 +1260,6 @@ void dx_clear_attachments(bool clear_depth_stencil, bool clear_color, vec4_t col
}
void dx_bind_geometry() {
if (!dx.active)
return;
// xyz stream
{
if ((dx.xyz_elements + tess.numVertexes) * sizeof(vec4_t) > XYZ_SIZE)

View File

@ -915,14 +915,10 @@ const void *RB_DrawBuffer( const void *data ) {
qglClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
// VULKAN
if (vk.active) {
// DX12
if (vk.active || dx.active) {
RB_SetGL2D(); // to ensure we have viewport that occupies entire window
vk_clear_attachments(false, true, color);
}
// DX12
if (dx.active) {
RB_SetGL2D(); // to ensure we have viewport that occupies entire window
dx_clear_attachments(false, true, color);
}
}
@ -1006,11 +1002,8 @@ void RB_Show_Vk_Dx_Images() {
float black[4] = {0, 0, 0, 1};
if (vk.active)
vk_clear_attachments(false, true, black);
if (dx.active)
dx_clear_attachments(false, true, black);
vk_clear_attachments(false, true, black);
dx_clear_attachments(false, true, black);
for (int i = 0 ; i < tr.numImages ; i++) {

View File

@ -1461,11 +1461,15 @@ void R_DebugPolygon( int color, int numPoints, float *points ) {
tess.numIndexes += 3;
}
vk_bind_geometry();
vk_shade_geometry(vk.surface_debug_pipeline_solid, false, Vk_Depth_Range::normal);
if (vk.active) {
vk_bind_geometry();
vk_shade_geometry(vk.surface_debug_pipeline_solid, false, Vk_Depth_Range::normal);
}
dx_bind_geometry();
dx_shade_geometry(dx.surface_debug_pipeline_solid, false, Vk_Depth_Range::normal, true, false);
if (dx.active) {
dx_bind_geometry();
dx_shade_geometry(dx.surface_debug_pipeline_solid, false, Vk_Depth_Range::normal, true, false);
}
// Outline.
Com_Memset(tess.svars.colors, tr.identityLightByte, numPoints * 2 * sizeof(color4ub_t));
@ -1477,11 +1481,15 @@ void R_DebugPolygon( int color, int numPoints, float *points ) {
tess.numVertexes = numPoints * 2;
tess.numIndexes = 0;
vk_bind_geometry();
vk_shade_geometry(vk.surface_debug_pipeline_outline, false, Vk_Depth_Range::force_zero, false);
if (vk.active) {
vk_bind_geometry();
vk_shade_geometry(vk.surface_debug_pipeline_outline, false, Vk_Depth_Range::force_zero, false);
}
dx_bind_geometry();
dx_shade_geometry(dx.surface_debug_pipeline_outline, false, Vk_Depth_Range::force_zero, false, true);
if (dx.active) {
dx_bind_geometry();
dx_shade_geometry(dx.surface_debug_pipeline_outline, false, Vk_Depth_Range::force_zero, false, true);
}
tess.numVertexes = 0;
}

View File

@ -773,10 +773,12 @@ static void ComputeTexCoords( shaderStage_t *pStage ) {
static void RB_IterateStagesGeneric( shaderCommands_t *input )
{
// VULKAN
vk_bind_geometry();
if (vk.active)
vk_bind_geometry();
// DX12
dx_bind_geometry();
if (dx.active)
dx_bind_geometry();
for ( int stage = 0; stage < MAX_SHADER_STAGES; stage++ )
{

View File

@ -2202,9 +2202,6 @@ void vk_clear_attachments(bool clear_depth_stencil, bool clear_color, vec4_t col
}
void vk_bind_geometry() {
if (!vk.active)
return;
// xyz stream
{
if ((vk.xyz_elements + tess.numVertexes) * sizeof(vec4_t) > XYZ_SIZE)