Proper images selection, so animation images work now.
This commit is contained in:
parent
121afa2231
commit
6d50cb783c
|
|
@ -44,23 +44,26 @@ static float s_flipMatrix[16] = {
|
||||||
** GL_Bind
|
** GL_Bind
|
||||||
*/
|
*/
|
||||||
void GL_Bind( image_t *image ) {
|
void GL_Bind( image_t *image ) {
|
||||||
int texnum;
|
image_t* final_image = image;
|
||||||
|
|
||||||
if ( !image ) {
|
if (!final_image) {
|
||||||
ri.Printf( PRINT_WARNING, "GL_Bind: NULL image\n" );
|
ri.Printf( PRINT_WARNING, "GL_Bind: NULL image\n" );
|
||||||
texnum = tr.defaultImage->texnum;
|
final_image = tr.defaultImage;
|
||||||
} else {
|
|
||||||
texnum = image->texnum;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( r_nobind->integer && tr.dlightImage ) { // performance evaluation option
|
if ( r_nobind->integer && tr.dlightImage ) { // performance evaluation option
|
||||||
texnum = tr.dlightImage->texnum;
|
final_image = tr.dlightImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int texnum = final_image->texnum;
|
||||||
|
|
||||||
if ( glState.currenttextures[glState.currenttmu] != texnum ) {
|
if ( glState.currenttextures[glState.currenttmu] != texnum ) {
|
||||||
image->frameUsed = tr.frameCount;
|
image->frameUsed = tr.frameCount;
|
||||||
glState.currenttextures[glState.currenttmu] = texnum;
|
glState.currenttextures[glState.currenttmu] = texnum;
|
||||||
qglBindTexture (GL_TEXTURE_2D, texnum);
|
qglBindTexture (GL_TEXTURE_2D, texnum);
|
||||||
|
|
||||||
|
// VULKAN
|
||||||
|
glState.vk_current_images[glState.currenttmu] = final_image;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1853,6 +1853,10 @@ void R_DeleteTextures( void ) {
|
||||||
tr.numImages = 0;
|
tr.numImages = 0;
|
||||||
|
|
||||||
Com_Memset( glState.currenttextures, 0, sizeof( glState.currenttextures ) );
|
Com_Memset( glState.currenttextures, 0, sizeof( glState.currenttextures ) );
|
||||||
|
|
||||||
|
// VULKAN
|
||||||
|
Com_Memset( glState.vk_current_images, 0, sizeof( glState.vk_current_images ) );
|
||||||
|
|
||||||
if ( qglBindTexture ) {
|
if ( qglBindTexture ) {
|
||||||
GL_SelectTexture( 1 );
|
GL_SelectTexture( 1 );
|
||||||
qglBindTexture( GL_TEXTURE_2D, 0 );
|
qglBindTexture( GL_TEXTURE_2D, 0 );
|
||||||
|
|
|
||||||
|
|
@ -810,6 +810,9 @@ typedef struct {
|
||||||
int texEnv[2];
|
int texEnv[2];
|
||||||
int faceCulling;
|
int faceCulling;
|
||||||
unsigned long glStateBits;
|
unsigned long glStateBits;
|
||||||
|
|
||||||
|
// VULKAN
|
||||||
|
image_t* vk_current_images[2];
|
||||||
} glstate_t;
|
} glstate_t;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -856,17 +856,11 @@ void Vulkan_Demo::render_tess(const shaderStage_t* stage) {
|
||||||
vkCmdBindVertexBuffers(command_buffer, 0, 1, &tess_vertex_buffer, &tess_vertex_buffer_offset);
|
vkCmdBindVertexBuffers(command_buffer, 0, 1, &tess_vertex_buffer, &tess_vertex_buffer_offset);
|
||||||
vkCmdBindIndexBuffer(command_buffer, tess_index_buffer, tess_index_buffer_offset, VK_INDEX_TYPE_UINT32);
|
vkCmdBindIndexBuffer(command_buffer, tess_index_buffer, tess_index_buffer_offset, VK_INDEX_TYPE_UINT32);
|
||||||
|
|
||||||
VkDescriptorSet* set = &descriptor_set;
|
image_t* image = glState.vk_current_images[0];
|
||||||
VkDescriptorSet image_set;
|
VkDescriptorSet set = image_descriptor_sets[image];
|
||||||
|
|
||||||
image_t* image = stage->bundle[0].image[0];
|
|
||||||
if (image != nullptr) {
|
|
||||||
image_set = image_descriptor_sets[image];
|
|
||||||
set = &image_set;
|
|
||||||
}
|
|
||||||
|
|
||||||
update_uniform_buffer();
|
update_uniform_buffer();
|
||||||
vkCmdBindDescriptorSets(command_buffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline_layout, 0, 1, set, 1, &tess_ubo_offset);
|
vkCmdBindDescriptorSets(command_buffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline_layout, 0, 1, &set, 1, &tess_ubo_offset);
|
||||||
tess_ubo_offset += tess_ubo_offset_step;
|
tess_ubo_offset += tess_ubo_offset_step;
|
||||||
|
|
||||||
VkViewport viewport;
|
VkViewport viewport;
|
||||||
|
|
@ -943,8 +937,8 @@ void Vulkan_Demo::render_tess_multi(const shaderStage_t* stage) {
|
||||||
vkCmdBindVertexBuffers(command_buffer, 0, 1, &tess_vertex_buffer, &tess_vertex_buffer_offset);
|
vkCmdBindVertexBuffers(command_buffer, 0, 1, &tess_vertex_buffer, &tess_vertex_buffer_offset);
|
||||||
vkCmdBindIndexBuffer(command_buffer, tess_index_buffer, tess_index_buffer_offset, VK_INDEX_TYPE_UINT32);
|
vkCmdBindIndexBuffer(command_buffer, tess_index_buffer, tess_index_buffer_offset, VK_INDEX_TYPE_UINT32);
|
||||||
|
|
||||||
image_t* image = stage->bundle[0].image[0];
|
image_t* image = glState.vk_current_images[0];
|
||||||
image_t* image2 = stage->bundle[1].image[0];
|
image_t* image2 = glState.vk_current_images[1];
|
||||||
auto images = std::make_pair(image, image2);
|
auto images = std::make_pair(image, image2);
|
||||||
auto it = multitexture_descriptor_sets.find(images);
|
auto it = multitexture_descriptor_sets.find(images);
|
||||||
if (it == multitexture_descriptor_sets.cend()) {
|
if (it == multitexture_descriptor_sets.cend()) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user