r_showImages functionality.
Additionally replaced VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE with VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER. This matches more closely GL_CLAMP mode used by the OpenGL backend.
This commit is contained in:
parent
f5b0d1e51d
commit
68723c7076
|
|
@ -3,8 +3,11 @@ Removed cvars:
|
|||
* r_allowSoftwareGL
|
||||
* r_clear
|
||||
* r_colorbits (use desktop color depth)
|
||||
* r_displayRefresh
|
||||
* r_dlightBacks
|
||||
* r_ext_multitexture (required)
|
||||
* r_finish
|
||||
* r_ignore
|
||||
* r_ignoreFastPath
|
||||
* r_maskMinidriver
|
||||
* r_measureOverdraw
|
||||
|
|
|
|||
|
|
@ -890,10 +890,14 @@ void RB_ShowImages( void ) {
|
|||
float x, y, w, h;
|
||||
int start, end;
|
||||
|
||||
if (!gl_enabled())
|
||||
return;
|
||||
|
||||
if ( !backEnd.projection2D ) {
|
||||
RB_SetGL2D();
|
||||
}
|
||||
|
||||
qglClearColor(0, 0, 0, 1);
|
||||
qglClear( GL_COLOR_BUFFER_BIT );
|
||||
|
||||
qglFinish();
|
||||
|
|
@ -931,7 +935,76 @@ void RB_ShowImages( void ) {
|
|||
|
||||
end = ri.Milliseconds();
|
||||
ri.Printf( PRINT_ALL, "%i msec to draw all images\n", end - start );
|
||||
}
|
||||
|
||||
// VULKAN
|
||||
void RB_ShowVkImages() {
|
||||
if (!vk.active) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !backEnd.projection2D ) {
|
||||
RB_SetGL2D();
|
||||
}
|
||||
|
||||
float black[4] = {0, 0, 0, 1};
|
||||
vk_clear_attachments(false, true, black);
|
||||
|
||||
for (int i = 0 ; i < tr.numImages ; i++) {
|
||||
auto image = tr.images[i];
|
||||
|
||||
float w = glConfig.vidWidth / 20;
|
||||
float h = glConfig.vidHeight / 15;
|
||||
float x = i % 20 * w;
|
||||
float y = i / 20 * h;
|
||||
|
||||
// show in proportional size in mode 2
|
||||
if ( r_showImages->integer == 2 ) {
|
||||
w *= image->uploadWidth / 512.0f;
|
||||
h *= image->uploadHeight / 512.0f;
|
||||
}
|
||||
|
||||
GL_Bind( image );
|
||||
|
||||
tess.numIndexes = 6;
|
||||
tess.numVertexes = 4;
|
||||
|
||||
tess.indexes[0] = 0;
|
||||
tess.indexes[1] = 1;
|
||||
tess.indexes[2] = 2;
|
||||
tess.indexes[3] = 0;
|
||||
tess.indexes[4] = 2;
|
||||
tess.indexes[5] = 3;
|
||||
|
||||
tess.xyz[0][0] = x;
|
||||
tess.xyz[0][1] = y;
|
||||
tess.svars.texcoords[0][0][0] = 0;
|
||||
tess.svars.texcoords[0][0][1] = 0;
|
||||
|
||||
tess.xyz[1][0] = x + w;
|
||||
tess.xyz[1][1] = y;
|
||||
tess.svars.texcoords[0][1][0] = 1;
|
||||
tess.svars.texcoords[0][1][1] = 0;
|
||||
|
||||
tess.xyz[2][0] = x + w;
|
||||
tess.xyz[2][1] = y + h;
|
||||
tess.svars.texcoords[0][2][0] = 1;
|
||||
tess.svars.texcoords[0][2][1] = 1;
|
||||
|
||||
tess.xyz[3][0] = x;
|
||||
tess.xyz[3][1] = y + h;
|
||||
tess.svars.texcoords[0][3][0] = 0;
|
||||
tess.svars.texcoords[0][3][1] = 1;
|
||||
|
||||
Com_Memset( tess.svars.colors, tr.identityLightByte, tess.numVertexes * 4 );
|
||||
vk_bind_resources_shared_between_stages();
|
||||
vk_bind_stage_specific_resources(vk.images_debug_pipeline, false, Vk_Depth_Range::normal);
|
||||
vkCmdDrawIndexed(vk.command_buffer, tess.numIndexes, 1, 0, 0, 0);
|
||||
vk_resources.dirty_attachments = true;
|
||||
vk.xyz_elements += tess.numVertexes;
|
||||
}
|
||||
tess.numIndexes = 0;
|
||||
tess.numVertexes = 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -952,6 +1025,7 @@ const void *RB_SwapBuffers( const void *data ) {
|
|||
// texture swapping test
|
||||
if ( r_showImages->integer ) {
|
||||
RB_ShowImages();
|
||||
RB_ShowVkImages();
|
||||
}
|
||||
|
||||
cmd = (const swapBuffersCommand_t *)data;
|
||||
|
|
|
|||
|
|
@ -1192,6 +1192,11 @@ void vk_initialize() {
|
|||
def.line_primitives = true;
|
||||
vk.surface_debug_pipeline_outline = create_pipeline(def);
|
||||
}
|
||||
{
|
||||
Vk_Pipeline_Def def;
|
||||
def.state_bits = GLS_DEPTHTEST_DISABLE | GLS_SRCBLEND_SRC_ALPHA | GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA;
|
||||
vk.images_debug_pipeline = create_pipeline(def);
|
||||
}
|
||||
}
|
||||
vk.active = true;
|
||||
}
|
||||
|
|
@ -1248,6 +1253,7 @@ void vk_shutdown() {
|
|||
vkDestroyPipeline(vk.device, vk.normals_debug_pipeline, nullptr);
|
||||
vkDestroyPipeline(vk.device, vk.surface_debug_pipeline_solid, nullptr);
|
||||
vkDestroyPipeline(vk.device, vk.surface_debug_pipeline_outline, nullptr);
|
||||
vkDestroyPipeline(vk.device, vk.images_debug_pipeline, nullptr);
|
||||
|
||||
vkDestroySwapchainKHR(vk.device, vk.swapchain, nullptr);
|
||||
vkDestroyDevice(vk.device, nullptr);
|
||||
|
|
@ -1837,7 +1843,7 @@ VkSampler vk_find_sampler(const Vk_Sampler_Def& def) {
|
|||
ri.Error(ERR_DROP, "vk_find_sampler: MAX_VK_SAMPLERS hit\n");
|
||||
}
|
||||
|
||||
VkSamplerAddressMode address_mode = def.repeat_texture ? VK_SAMPLER_ADDRESS_MODE_REPEAT : VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE;
|
||||
VkSamplerAddressMode address_mode = def.repeat_texture ? VK_SAMPLER_ADDRESS_MODE_REPEAT : VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER;
|
||||
|
||||
VkFilter mag_filter;
|
||||
if (def.gl_mag_filter == GL_NEAREST) {
|
||||
|
|
|
|||
|
|
@ -182,6 +182,7 @@ struct Vk_Instance {
|
|||
VkPipeline normals_debug_pipeline;
|
||||
VkPipeline surface_debug_pipeline_solid;
|
||||
VkPipeline surface_debug_pipeline_outline;
|
||||
VkPipeline images_debug_pipeline;
|
||||
};
|
||||
|
||||
struct Vk_Resources {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user