this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Added check and comment so GPU_BlitBatch() does not accept partial passthrough.

+13 -5
+11 -4
SDL_gpu/SDL_gpu.c
··· 570 570 return current_renderer->BlitBatch(current_renderer, src, dest, numSprites, values, flags); 571 571 572 572 // Conversion time... 573 - int size = numSprites*(12 + 8 + 16); 574 - float* new_values = (float*)malloc(sizeof(float)*size); 575 573 576 574 // Convert condensed interleaved format into full interleaved format for the renderer to use. 577 575 // Condensed: Each vertex has 2 pos, 4 rect, 4 color ··· 587 585 Uint8 pass_vertices = (flags & GPU_PASSTHROUGH_VERTICES); 588 586 Uint8 pass_texcoords = (flags & GPU_PASSTHROUGH_TEXCOORDS); 589 587 Uint8 pass_colors = (flags & GPU_PASSTHROUGH_COLORS); 588 + 589 + // Passthrough data is per-vertex. Non-passthrough is per-sprite. They can't interleave cleanly. 590 + if((flags & GPU_PASSTHROUGH_ALL) != GPU_PASSTHROUGH_ALL) 591 + { 592 + GPU_LogError("GPU_BlitBatch: Cannot interpret interleaved data using partial passthrough.\n"); 593 + return -1; 594 + } 595 + 590 596 if(pass_vertices) 591 597 src_position_floats_per_sprite = 12; // 4 vertices of x, y, z 592 598 if(pass_texcoords) ··· 601 607 src_color_floats_per_sprite = 0; 602 608 603 609 int src_floats_per_sprite = src_position_floats_per_sprite + src_rect_floats_per_sprite + src_color_floats_per_sprite; 610 + 611 + int size = numSprites*(12 + 8 + 16); 612 + float* new_values = (float*)malloc(sizeof(float)*size); 604 613 605 614 int n; // The sprite number iteration variable. 606 615 // Source indices (per sprite) ··· 617 626 float w2 = 0.5f*src->w; // texcoord helpers for position expansion 618 627 float h2 = 0.5f*src->h; 619 628 620 - // FIXME: Does not do the right thing when pass_* is used. 621 - // I need to specify what the expected format is because mixing expanded values with passthrough values leads to format ambiguities. 622 629 for(n = 0; n < numSprites; n++) 623 630 { 624 631 if(no_rects)
+2 -1
SDL_gpu/SDL_gpu.h
··· 708 708 int GPU_BlitTransformMatrix(GPU_Image* src, GPU_Rect* srcrect, GPU_Target* dest, float x, float y, float* matrix3x3); 709 709 710 710 /*! Performs 'numSprites' blits of the 'src' image to the 'dest' target. 711 + * Note: GPU_BlitBatch() cannot interpret a mix of normal values and "passthrough" values due to format ambiguity. 711 712 * \param values A tightly-packed array of position (x,y), color (r,g,b,a) values with a range from 0-255, and src_rect (x,y,w,h) values in image coordinates 712 - * \param flags Bit flags to control the interpretation of the array parameters 713 + * \param flags Bit flags to control the interpretation of the array parameters. The only passthrough option accepted is GPU_PASSTHROUGH_ALL. 713 714 */ 714 715 int GPU_BlitBatch(GPU_Image* src, GPU_Target* dest, unsigned int numSprites, float* values, GPU_BlitFlagEnum flags); 715 716